python input method code example

Example 1: python input

#Collecting The Input As A Variable:#
name = input('Please enter your name: ')
#Printing The Variable:#
print(name)
#Checking The Variable And Printing Accordingly:#
if name == 'Joe':
  print('Joe Mama')

Example 2: how to take input in python

# Taking string input
a = input("Enter a string: ")
print("String is: ", a)

# Taking integer input
b = int(input("Enter an integer: "))
print("Integer is: ", b)

# Taking float input
c = float(input("Enter a float value: "))
print("Float value is: ", c)

Example 3: python how to use input

#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)

Example 4: python input

# The function 'input()' asks the user for input
myName = input()

Example 5: input function python

make_a_variable_name = input("Put whatever question, or prompt as Python calls it, that the person will answer here.")

Example 6: input in python

#input or question, is used to ask question

ans = input('Who invented Microsoft?')

#An if statement

if(ans == 'Bill Gates'):
  print('You got the answer')