This script works on python3, but to work with python2, in short, the lines that contain this content must be changed:
- Python2 →
print "String"
, Python3 → print("String")
- Python2 →
raw_input
, Python3 → input
For those who are starting in Python. It is not necessary to take a course from the start, but to analyze the Python syntax, such as:
- variables
- loops
- functions
- inputs
And among other basic things, but you can do a lot of things in mind. See the script below.
To run save with the name you want, for example: vim starting-at-python.py
, enter the code below and run:
Or give execute permission and run directly:
Basic Python Script for Learning
python
script
terminal
Marcos Oliveira
Software developer