Ask coding questions

← Back to all posts
What can I use more with input() 🧐
codermaster8 (7)

Do you 😎 know more things about input()

Answered by Bookie0 (6358) [earned 5 cycles]
View Answer
Bookie0 (6358)

What do you want to know about input()? Check this out for more.

Good luck! :D

OldWizard209 (1608)

wdym? can you explicitly explain your question? You can get many different types of inputs but what exactly is your question'?

codermaster8 (7)

I want to learn more about the python command @OldWizard209

OldWizard209 (1608)

So basically, you can get user input, using the input() command and store it in a variable and use it. Like:

name = input("Enter your name: ")

print(f"Your name is {name}.")

You can also change input data types:

age= int(input("Enter your age: "))

print(f"You are {age} years old.")

I am not sure if this is what you want? Getting input is vast and what exactly can I help you with?

codermaster8 (7)

This is a bit similar what i know but can you explain more about it @OldWizard209

OldWizard209 (1608)

I will try my best.
User input in python is exactly like working with a variable defined to somehting, except, it depends on what the user inputs. For example, we can use user input to actually print out if they are old enough using conditionals.

age = int(input("Enter your age: "))

if age >= 18:
    print("You are old enough")
elif age < 18:
    print("You arenot  old enough")

Once again, you never know what the user inputs, so you have to be able to handle all exceptions. you can do that using try except and while loops. But I hope I have helped you enough to give you a basic understanding.