what‘s the meaning of this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what‘s the meaning of this?

fill in the blanks to declare a variable,add 5 to it and print its value I have got stuck for a long time

30th Jan 2018, 11:51 AM
onlymexxx
onlymexxx - avatar
4 Answers
+ 1
x = 4 x += 5 print(x)
3rd Feb 2018, 3:40 AM
Dread
Dread - avatar
+ 1
So, this is basically saying create a variable, add five to it, and print the value. Think of a variable like a container for data, so lets say... money, right? Let's say money holds the value 0, because someone is poor. So, what you would type is: money = 0 Then to add five, you could either do: money = money + 5 (this is reassigning the variable with a new value) or: money += 5 (this is the same as above, but just typed differently) Hope this helps! 👍
30th Jan 2018, 11:59 AM
Dread
Dread - avatar
+ 1
Thank you!
3rd Feb 2018, 3:43 AM
onlymexxx
onlymexxx - avatar
0
Well,ty.I know ‘money +=5’ but how can I print the valve: >>>x=4 >>>x+=5 >>>print () I’ve tried to enter ‘print (“9”)’ or ‘print (9)’,but it’s all wrong.
3rd Feb 2018, 3:04 AM
onlymexxx
onlymexxx - avatar