xxxxxxxxxx
a = input("Enter a number: ")
a = int(a) # Convert a to an Integer(if possible)
print(type(a))
xxxxxxxxxx
#basic user handling for begginers
x = input("your question here") # when someone types something here that answer will be saved and be used for later
# for example
print(x)
xxxxxxxxxx
name = input("What is your name?\n") # Asks the user 'What is your name?' and stores it in the 'name' variable
print("You said your name was " + name)
number = int(input("Please select a random number:\n")) # Will get input as a number
# Will error if the value entered is not a number
# You can use any type of conversion (int(), bool(), float(), etc.) to modify your input
xxxxxxxxxx
# to greet somebody with their name you do like the following
def greet(name):
print(f"Hello, {name} How do you do?")
greet("John Due") # you will get Hello, John Due How do you do?
# if you wanna get the input from the user you can do that too!
name = input("Please enter your name: ")
greet(name) # this takes the input from the user and then greets the user
xxxxxxxxxx
#String
input("Type: ")
#Integer
int(input("Number: "))
#Float
float(input("Decimal Number: "))
xxxxxxxxxx
name = input("Enter your name: ")
#Printing the variable (name)
print("hello",name)
xxxxxxxxxx
# we make the input to take the name of user
name = input("inter your name : ")
# this input to take the age
age = input("inter your age : ")
# the print to say to user hi and this is your age
print(f"hi {name} your age is {age}")
xxxxxxxxxx
#The input command will popup/print the text placed inside the brackets.
#After the text you can type anything and press enter.
#Then the stuff written in the ansfer field will be saved as the function value.
x = input("write anything after this: ")
print(x)
#This code will first print the stuff written in input (write anything after this:).
#Then it will store the text as the x value.
#Then it will print it.
xxxxxxxxxx
make_a_variable_name = input("Put whatever question, or prompt as Python calls it, that the person will answer here.")