1#Collecting The Input As A Variable:#
2name = input('Please enter your name: ')
3#Printing The Variable:#
4print(name)
5#Checking The Variable And Printing Accordingly:#
6if name == 'Joe':
7 print('Joe Mama')
1#basic user handling for begginers
2
3x = input("your question here") # when someone types something here that answer will be saved and be used for later
4
5# for example
6print(x)
1# First, let's start with a simple input function.
2input("What's your name?: ") #This will ask you what is your name, and you can input anything you want.
3#The above code is simple, and theres not much you can do with it.
4
5# Let's get a little harder!
6name = input("What is your name? ") # Just adding a variable doesn't look like much, but it goes a long way!
7print("Hello," , name , ", I'm dad!") # THis will print Hello [your name] I'm dad when the user inputs a name.
8
9# Let's make this a little more advanced!
10name = input("What is your name? )
11if name == "Dad": # Now if sombody inputs 'Dad' as there name:
12 print("Hi dad I'm- wait a minute...") # it will say this
13else: # If a user prints anything else:
14 print("Hi" , name , "I'm dad!") # It will output this!
15
16# What if I want to add multiple names? Well, that's entirly possible, with the elif statment
17if name == "Dad": # If the user inputs "Dad" as their input:
18 print("Hi Dad, I'm- stop trying to trick me D:<") # It will output this
19elif name == "Doggo": # If the name is "Doggo":
20 print("Hi doggo- wait your not supposed to talk?") # It will output this:
21# Using the elif statment, we can make an entirley different with only one question asked
22else:
23 print("Hello, ", name, "!") # We always end an if statment with an else one.
24
25# Hope this helped! :D
1#The input command will popup/print the text placed inside the brackets.
2#After the text you can type anything and press enter.
3#Then the stuff written in the ansfer field will be saved as the function value.
4
5x = input("write anything after this: ")
6print(x)
7
8#This code will first print the stuff written in input (write anything after this:).
9#Then it will store the text as the x value.
10#Then it will print it.