Lesson 4
Getting User Input
Learn to make programs interactive with user input
1Making Programs Interactive✨
- So far: programs show same output every time
- Better: programs respond to user input!
2The input() Function🎯
💻 code
name = input("What's your name? ")
print("Hello, " + name)💻 code
Important: input() returns text (string)
age_text = input("How old are you? ")
age = int(age_text) # Convert to number3Type Conversion💡
💻 code
int() → converts to whole numbers
float() → converts to decimals
str() → converts to text4Complete Example🚀
💻 code
# Get user info
student_name = input("Enter name: ")
test_score = int(input("Enter score: "))
class_size = int(input("Class size: "))💻 code
# Display results
print("Student: " + student_name)
print("Score: " + str(test_score))
print("Class: " + str(class_size))🎯 Practice Challenges
Master Getting User Input by completing all 3 difficulty levels
🟢 EASY
Getting User Input - Easy Challenge
Start with the basics. Perfect for beginners!
🟡 MEDIUM
Getting User Input - Medium Challenge
Get more challenging. Build your confidence!
🔴 HARD
Getting User Input - Hard Challenge
Master this concept. Prove your skills!
🏆 Study a lesson for 2+ minutes to earn +10 TalentJR Points a day. Badges, certificates & prizes →
Ready to Master Getting User Input? 🚀
Complete the challenges, take the quiz and keep your learning streak going!
Keep learning
- ← Previous lessonLesson 3: Basic Arithmetic OperationsMaster mathematical operations in Python
- Next lesson →Lesson 5: String Operations & FormattingWork with text and format output beautifully
- Grade 6 coursePython Control FlowPython coding course for kids.
- Student ToolsFree calculators for studentsPercentage, fraction, ratio and marks calculators with steps.
- CBSEClass 5 CBSE & NCERT study materialMaths, Science and Computer chapters with solutions.
- Future SkillsExplore future skillsAI, robotics and new-age skills explained for students.