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 !?
4 ответов
+ 4
Maybe they meant something like this:
a = input("Enter something:")
print(a)
+ 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.
0
This is storage space created to hold data for processing its usually declared by the programmer