- 2
module quiz 2 pythyon
Fill in the blanks to declare a variable, add 5 to it and print its value. x = 4 x ..........= 5 print(............) help please ??????
5 Réponses
+ 2
Did you try 1st? What operator would you use to add two numbers together? How do you print a variable? I see you at least figured out the parentheses () for the print statement. You can go back and review the course to help yourself and then return to the question to try again.
0
The question is asking what happens if you ADD 5 to x. So if you know how to add something to a variable and then print it you can answer this.
0
Start with „Python for beginners“
0
The question is asking you to add 5 to the declared variable.
In the first line of code (x = 4), the variable "x" is declared as the integer 4.
In the second line of code (x __= 5), you need to fill in the blank with the other half of the missing integer. Half of the answer is already given for you (=). here you should put the "+" symbol because the question is asking you to add. This gives you (x += 5).
In the final line of code, you simply need to print the variable. This would be print(x).
In case the "+=" symbol confuses you, just remember this:
x = 1
x += 1
is the exact same thing as
x = 1
x = x + 1
Both of these would give you the same output of 2.
- 3
x=4
x+=5
print(x)