-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
65 lines (43 loc) · 1.5 KB
/
main.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
#Jaunel Deans
#September 18, 2023
#We are investigating with is a wrong with the code and answer the questions given.
### Example Code 1
fName = "Mr"
lName = "Colley"
print(fName)
# Identify a variable in the code
# Answer: fName & lName
# Identify a string in the code
# Answer: "Mr" & "Colley"
# Line 4 is changed to lName = "Thorpe". How does this affect the output?
#Answer: There is no output because the print statement called for fName not lName
#We would not see the "Thorpe."
# Line 3 is changed to fName = "Mrs". How does this affect the output?
# Answer: The output would be Mrs. because the print statment called for fName and show
# What is in the variable which is Mrs.
### Example Code 2
num1 = 20
num2 = 5
total1 = num1 + 15
total2 = num2 * 2
total3 = num1 - num2
print(total3)
# What will be output by the program?
# Answer: 15
### Example Code 3
name1 = "Ross"
name2 = "Monica"
name3 = "Joey"
name4 = "Rachel"
name5 = "Chandler"
print(name1 + " and " + name4)
print(name3)
name3 = "Phoebe"
# How many variables are used in the program?
# Answer 3
# What would be the impact of changing print(name1, " and ", name4) to print(name1, " and ", name5) ?
# Answer The names would have comms and spaces after them
# What is the purpose of the '+' symbol in print(name1, " and ", name4)
# Answer: to join both variables together
# The line print(name3) is added to the end of the code. Explain what it will do.
# Answer: It will show what is in variable named name3 which is Phoebe