-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex3.py
37 lines (28 loc) · 775 Bytes
/
ex3.py
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
36
37
print "I will now count my chickens:"
# 25 plus 5 is 30
print "Hens", 25 + 30 / 6
# Multipliplication and modulus has the same precedence
# so the one on the left gets evaluated first:
# 100 - (75 % 4)
print "Roosters", 100 - 25 * 3 % 4
print "Now I will count the eggs:"
# 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
# 3 + 2 + 1 - 5 + 0 - 0 + 6
# 1 + 6
# 7
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
print "Is it true that 3 + 2 < 5 - 7?"
# 5 is not less than -2, so this is evaulated as False
print 3 + 2 < 5 - 7
# 5
print "What is 3 + 2?", 3 + 2
# -2
print "What is 5 - 7", 5 - 7
print "Oh, that's why it's False."
print "How about some more."
# True
print "Is it greater?", 5 > -2
# True
print "Is it greater or equal?", 5 >= -2
# False
print "Is is less or equal?", 5 <= -2