-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex3_mod2.py
49 lines (37 loc) · 1.1 KB
/
ex3_mod2.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
38
39
40
41
42
43
44
45
46
47
48
49
# Assign numbers to variables
i = 3
j = 2
k = i - j
print "k = ", k
x = (i + j) * (i + j)
print "x = ", x
y = (i + j) * i * j
print "y = ", y
z = (i * j)
print "z = ", z
# Declare intent
print "I will now count my chickens:"
# Calculate number of hens
print "Hens", x + y / z
# Calculate number of roosters, rounded to the nearest whole number
print "Roosters", 100 - x * 3 % 4
# Declare intent to count eggs
print "Now I will count the eggs:"
# Long string of arithmatical operations resulting in number of eggs rounded to nearest whole number
print i + j + k - 5 + 4 % j - k / 4 + z
# Introduction to comparison operations
# Declaration of intent
print "Is it true that 3 + 2 < 5 - 7?"
# Calculate T/F using math
print i + j < (i + j) - 7
# Breakdown of comparison sides
print "What is 3 + 2?", i + j
print "What is 5 - 7?", (i + j) - 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