+ 1
How do i declare a variable
I was tasked with declaring a variable and to add 5 to it but am finding it really difficult. i just started today. here is the code below x=4 x_=5 print___
4 Answers
+ 9
x=4
x+=5
print(x)
+ 1
x=0
x=x+5
+ 1
writing one extra x is just redundant.
x+=5 is same as x=x+5. and no it wouldn't continue grow because you are doing it only once
0
Question on the answer. Why would you use that same variable name? if you do x=x+5, wouldn't that continue to just grow?
x=value
y=value+5
print(y)
I am sure my logic is flawed, so any explanation would be appreciated.