Introduction to Python
Provided Files
Example Code
Model 1 – copy into the editor, save as hello.py
# display a welcome message
print("Welcome to Python 3!")
# give the user a compliment
name = input("What's your name? ")
print(name, "is a great name!")
Model 2 – copy one line at a time into the shell
input("enter the mass in grams: ")
mass = input("enter another mass in grams: ")
mass
unit = input("enter the units for mass: ")
print(mass, unit)
print(mass / 2)
ten = 10
print(ten / 2)
abs(-1)
abs(-1 * ten)
Model 3 – copy one line at a time into the shell