How can we take input in Python?

In Python, you can get input from the user using the input() function.

enhanced (15).jpg

The input() function always gives you the input as a string.

So you usually need to change it to other types like numbers (int, float, etc.) when needed.

enhanced (17).jpg

Practice:

Q. Take input name, age, and weight and return it.

Answer:

name = input("Type your name: ")
age = int(input("What is your age: "))
weight = float(input("How fat you are: "))

print("My name is ",name)
print("I am ",age," years old")
print("My weight is ",weight,"kg")

'''
Output:

Type your name: Tarif
What is your age: 22
How fat you are: 99.99

My name is  Tarif
I am  22  years old
My weight is  99.99 kg
'''

enhanced (18).jpg