-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex3.py
37 lines (28 loc) · 1.63 KB
/
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
# This line prints the text stated
print("I will now count my chickens:")
# This line prints the result of 30 divided by 6, then adds the answer (5) to 25.
print("Hens", 25.0 + 30.0 / 6.0)
# This line prints the result of 25 multiplied by 3, then the remainder of 4/75, then subtracts this number from 100
print("Roosters", 100.0 - 25.0 * 3.0 % 4.0)
# This line prints the text stated
print("Now I will count the eggs:")
# This line prints the result of the operations; multiplication/division/modulus first then addition/subtraction
print(3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0)
# This line prints the text stated (as the equation is between the quotation marks, they are printed as they are typed; no operation is performed on them)
print("Is it true that 3 + 2 < 5 - 7?")
# This line now performs the true/false operation then prints the result
print(3.0 + 2.0 < 5.0 - 7.0)
# This prints the text stated, then performs the operation after the comma and prints the result
print("What is 3 + 2?", 3.0 + 2.0)
# This again prints the text stated, then performs the operation after the comma and prints the result
print("What is 5 - 7?", 5.0 - 7.0)
# This prints the text stated
print("Oh, that's why it's False.")
# This also prints the text stated
print("How about some more.")
# This prints the text, then performs the conditional operation and prints the result
print("Is it greater?", 5.0 > -2.0)
# This also prints the text, performs the conditional operation and prints the result
print("Is it greater or equal?", 5.0 >= -2.0)
# This one prints the text, performs the operation and prints the result too
print("Is it less or equal?", 5.0 <= -2.0)