Sunday, December 13, 2015

5. What If

IN:
people = 20
cats = 30

if people < cats:
    print "Many cats! "

if people > cats:
    print "Not many cats."

OUT:
Many cats!

Tuesday, December 8, 2015

6. Asking Questions

IN:
print "How old are you? ",
age = raw_input()
print "You are %r old. " % (age)

OUT:
How old are you? 35
You are 35 old.

7. Variables and Names

IN:
cars = 100
drivers = 30
cars_not_driven = cars - drivers

print "There will be ", cars_not_driven, " empty cars today."

OUT:
There will be 70 empty cars today.

8. Numbers and Math

IN:
print "Hens ",  25 + 30 / 6

OUT:
Hens 30

Monday, December 7, 2015