0

Can some one help me with moduel 1 quiz q4

14th May 2017, 12:32 PM
Behramkhan
Behramkhan - avatar
3 Antworten
+ 3
OK the question is: Fill in the blanks to declare a variable, add 5 to it and print its value. >>> x = 4 >>> x _= 5 >>> print___ They did the first part for you: the variable x is declared with a value of 4. Now you have to add 5 to the variable. Because there is a blank before the = sign, it looks like they want you to use the in place operator +=. Remember x += 5 is a short way of writing x = x + 5. So the first blank is +. Then you have to print the result, so the command is print(x), i.e. the second blank is (x). Don't forget the () (required in Python 3). Aside: the last two lines could have been combined by simply using print(x + 5).
16th May 2017, 9:42 PM
David Ashton
David Ashton - avatar
+ 2
>>> x += 5 >>> print(x)
14th May 2017, 12:46 PM
CHMD
CHMD - avatar
+ 1
post your question here
14th May 2017, 12:38 PM
Hamza Ahmed Khan
Hamza Ahmed Khan - avatar