0

Variables

"You can also take the value of the variable from the user input." I wounder how we can use the value of the variable if it differs from user to another !?

27th May 2017, 11:26 PM
kazuto
3 Réponses
+ 4
Maybe they meant something like this: a = input("Enter something:") print(a)
27th May 2017, 11:29 PM
Tim G
Tim G - avatar
+ 1
# You can use it in many ways. For example, imagine that you are making a "guess my number game" you could do this: import random my_num = random.randint(1, 100) # then you could ask the user to guess what is your number: user_num = input(' an you guess what is my number: ') # if the user guesses it it won, otherwise it lose: if user_num == my_num: print('You guessed it. Very well done.') else: print('You failed. My number was %d' % my_num) # This is just an example of how you could use user data. # use your imagination and you'll find many others.
27th May 2017, 11:36 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
This is storage space created to hold data for processing its usually declared by the programmer
28th May 2017, 2:31 AM
Obikoya Olumide
Obikoya Olumide - avatar