Python for Kids

Input in Python

1. What is Input?

  • input() takes data from user
  • Makes programs interactive
  • Always returns a string

2. Taking User Input

Example:

name = input("Enter your name: ")

3. Input with Typecasting

  • The int() function will convert input into numbers as age is a number.

Example:

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

4. Area Calculator Example

length = float(input("Enter length: "))
width = float(input("Enter width: "))
area = length * width

5. Shopping Cart Example

  • Item name (string)
  • Price (float)
  • Quantity (int)
  • Total = price × quantity

6. Summary

  • Using input()
  • Typecasting with input
  • Real-life programs

7. Task

  • Create a calculator
  • OR make a quiz program