-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex03.py
More file actions
35 lines (26 loc) · 950 Bytes
/
Copy pathex03.py
File metadata and controls
35 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Exercise 3, Learning Python the Hard Way"""
# Print the statement
print "I will now count my chickens:"
# Calculate the number of hens
print "Hens", 25.00 + 30.00 / 6.00
# Caluclate the number of roosters
print "Roosters", 100.00 - 25.00 * 3.00 % 4.00
# Print out the eggs
print "Now I will count the eggs:"
# Calculate the number of eggs
print 3.00 + 2.00 + 1.00 - 5.00 + 4.00 % 2.00 - 1.00 / 4.00 + 6.00
# Print yet another statement
print "Is it true that 3 + 2 < 5 - 7?"
# Calculate the truth!
print 3.00 + 2.00 < 5.00 - 7.00
# Print questions then calculate the results
print "What is 3 + 2?", 3.00 + 2.00
print "What is 5 - 7?", 5.00 - 7.00
# Print another statement
print "Oh, that's why it's False."
# Another print example
print "How about some more."
# Print some more statements then run equations:
print "Is it greater?", 5.00 > -2.00
print "Is it greater or equal?", 5.00 >= -2.00
print "Is it less or equal?", 5.00 <= -2.00