-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteach5.py
66 lines (44 loc) · 1.69 KB
/
teach5.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#Hello! For this activity, start with program 1 and see if you can update the program with the suggestions. When you are ready simply move to the next program and remove the comments from the code to run it.
#------------------PROGRAM 1--------------------
#Can you modify this program to print a different message?
#Can you modify this program to print two messages?
#Code:
print("Hello World!")
#------------------PROGRAM 2--------------------
#Can you modify the program to subtract 4 and 7?
#Can you modify the program to add 4, 7, and 9?
#Code:
#print("Adding 4 and 7")
#num1 = 4
#num2 = 7
#result = num1 + num2
#print(result)
#------------------PROGRAM 3--------------------
#Modify the program to also do each of these:
#Subtract the numbers and print the solution
#Multiply the numbers and print the solution
#Divide the numbers and print the solution
#Code:
#print("Enter first number: ")
#num1 = int(input())
#print("Enter second number: ")
#num2 = int(input())
#print("Adding numbers…")
#result = num1 + num2
#print(result)
#------------------PROGRAM 4--------------------
#Can you modify the program to also allow multiplication and division?
#Code:
#num1 = int(input("Enter the first number: "))
#num2 = int(input("Enter the second number: "))
#operator = input("Enter the operation (+, -): ")
#if operator == "+":
# print(num1 + num2)
#elif operator == "-":
# print(num1 - num2)
#------------------PROGRAM 5--------------------
#Use what you've learned so far to program your own calculator. Feel free to re-use code. Can you include these things:
#Allow user to do multiple subsequent operations
#Allow exponent operations
#Allow user to perform operations on more than 2 numbers
#Code: