+ 3
How have you been learning Python without writing a Python script? Practice is very important for learning to program. Were you using Python's Idle editor without saving any scripts?
It isn't hard to get a simple script.
1. Install Python if you haven't already.
2. Write a file named hello.py with this one line in it:
print('Hello World')
3. cd into the directory of that file and run the command 'python hello.py'.
If 'python' is not a recognized command, update your PATH environment variable to include the directory containing your installed python interpreter, close terminal and open a new terminal to try running again.
Otherwise, it should just print:
Hello World
Showing that your script ran properly.
Installing Python in Windows 10:
https://www.youtube.com/watch?v=4Rx_JRkwAjY
That shows how to install Python and run Python from a terminal. That doesn't show how to set the PATH environment variable because python was recognized immediately after installation.
Just in case you're struggling with a broken code at:
https://code.sololearn.com/ccwM7zzG9a1H/#py
That code can run with a few fixes made below:
number=24
guess=int(input("enter the age"))
if guess==number:
print ("u guess it right")
#the while block stop
elif guess>number:
print ("it is a little lower than that")
else:
print ("wrong")
The fixes I made include:
- consistently indenting code that should be in the if, elif, and else blocks.
- added : for the if, elif, and else sections.