python input

Do you want to know the information regarding “python input”. If yes, you’re in the correct tutorial.

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

#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)
answer = input('What is your name?')
a = input("Enter a number: ")
a = int(a) # Convert a to an Integer(if possible)
print(type(a))
name = input.("what is your name? ")
print("so youre name = " + name)

Final Thoughts

I hope this article helps you to know about “python input”. If you have any doubts regarding this post please let us know via the comment section. Share this article with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment