Answers for "how to take an input in python"

86

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')
Posted by: Guest on August-09-2020
12

how to get user inout in python

#just get input
test = input()

#add a custom message
test = input("Please enter your information: ")

#turning what is inputed into a differnt type of data
test = int(input("Please enter your information: "))
Posted by: Guest on March-05-2020
10

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)
Posted by: Guest on March-25-2020
1

how to use input in python

#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.
Posted by: Guest on May-07-2021
2

input in python

# First, let's start with a simple input function.
input("What's your name?: ") #This will ask you what is your name, and you can input anything you want.
#The above code is simple, and theres not much you can do with it.

# Let's get a little harder!
name = input("What is your name? ") # Just adding a variable doesn't look like much, but it goes a long way!
print("Hello," , name , ", I'm dad!") # THis will print Hello [your name] I'm dad when the user inputs a name.

# Let's make this a little more advanced!
name = input("What is your name? )
if name == "Dad": # Now if sombody inputs 'Dad' as there name:
	print("Hi dad I'm- wait a minute...") # it will say this
else: # If a user prints anything else:
	print("Hi" , name , "I'm dad!") # It will output this!

# What if I want to add multiple names? Well, that's entirly possible, with the elif statment
if name == "Dad": # If the user inputs "Dad" as their input:
	print("Hi Dad, I'm- stop trying to trick me D:<") # It will output this
elif name == "Doggo": # If the name is "Doggo":
	print("Hi doggo- wait your not supposed to talk?") # It will output this:
# Using the elif statment, we can make an entirley different with only one question asked
else:
	print("Hello, ", name, "!") # We always end an if statment with an else one.

# Hope this helped! :D
Posted by: Guest on December-24-2020
0

how to take an input in python

an_input = input("Input something please")
Posted by: Guest on September-19-2020

Code answers related to "how to take an input in python"

Python Answers by Framework

Browse Popular Code Answers by Language