TalentJR

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 number

3Type Conversion💡

💻 code
int() → converts to whole numbers
float() → converts to decimals
str() → converts to text

4Complete 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!