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')
1name = input("What is your name?\n") # Asks the user 'What is your name?' and stores it in the 'name' variable
2
3print("You said your name was " + name)
4
5number = int(input("Please select a random number:\n")) # Will get input as a number
6# Will error if the value entered is not a number
7
8# You can use any type of conversion (int(), bool(), float(), etc.) to modify your input
9
10
1# Learning input is very easy
2# Just make a variable and then the input function
3# then type what question do you want
4running = True
5mi = input('Are you a girl or a boy?')
6# Use def to figure it out
7l = mi
8if l == 'boy' or l == 'Boy':
9 ui = 'boy'
10elif l == 'girl' or l == 'Girl':
11 ui = 'girl'
12else:
13 # Make sure if it is a something not in the if
14 running = False
15 print('huh?')
16if running == True:
17 mine = input('How old are you?')
18 def v(u):
19 n = int(u)
20 if n > 3 and n < 11:
21 print('Good', ui)
22 else:
23 print('Great.')
24 # Remember to use the function
25 v(mine)
26
1# use the function input()
2
3# the parameter is something that would
4# output on the screen before the input
5
6name = input('What is your name?')
7print('Hello ' + name)
1# Now,we're using it with floats
2a = float(input("Input first number: "))
3b = float(input("Input second number: "))
4c = float(input("Input third number: "))
5if a > b:
6 if a < c:
7 median = a
8 elif b > c:
9 median = b
10 else:
11 median = c
12else:
13 if a > c:
14 median = a
15 elif b < c:
16 median = b
17 else:
18 median = c
19print('The median is: ', median)