-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex3-fp.py
36 lines (27 loc) · 987 Bytes
/
ex3-fp.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
# Declare intent
print "I will now count my chickens:"
# Calculate number of hens
print "Hens", 25 + 30 / 6
# Calculate number of roosters, rounded to the nearest whole number using modulo
print "Roosters", 100 - 25 * 3 % 4
# Declare intent to count eggs
print "Now I will count the eggs:"
# Long string of arithmatical operations resulting in exact number of eggs
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4.0 + 6
print "Alt method: ", 3 + 2 + 1 - 5 + 4 % 2 - 1.0 / 4 + 6
# Introduction to comparison operations
# Declaration of intent
print "Is it true that 3 + 2 < 5 - 7?"
# Calculate T/F using math
print 3 + 2 < 5 - 7
# Breakdown of comparison sides
print "What is 3 + 2?", 3 + 2
print "What is 5 - 7?", 5 - 7
# Witty comment
print "Oh, that's why it's False."
# Interrogative masquerading as a declarative
print "How about some more."
# Further mathematical comparisons
print "Is it greater?", 5 > -2
print "Is it greater or equal?", 5 >= -2
print "Is it less or equal?", 5 <= -2