TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun · 77.8K subscribers
Post #4424 3.09K
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print(num1 + num2)


Output:

30


🔹 12. Real-World Example

salary = float(input("Enter your monthly salary: "))
annual_salary = salary * 12
print(f"Your annual salary is {annual_salary}")


🎯 Practice Questions 

1. Take your name as input and print a welcome message. 

2. Take two integers as input and print their sum. 

3. Take a student's marks as input and print them using an f-string. 

4. Take the radius of a circle as input and calculate the area. 

5. Take your birth year as input and calculate your approximate age. 

🎯 Key Takeaways

✅ Use print() to display output

✅ Use input() to accept user input

✅ input() always returns a string

✅ Convert input using int() or float() when needed

✅ Use f-strings for clean and readable output formatting 

Double Tap ❤️ For More
  • ❤ 11
  • 🔥 1
More from @datasciencefun
  1. Oct 7, 2026ORDER BY salary DESC LIMIT 5; Mistake 3 — Forgetting that LIMIT applies after sorting For…
  2. Oct 7, 2026🚀 Data Science Roadmap 2026 📍 Phase 3: SQL for Data Science 📖 Topic 4 — LIMIT LIMIT is…
  3. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  4. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  5. Oct 2, 2026Data Visualisation tips for beginners
  6. Sep 29, 2026𝗙𝗥𝗘𝗘 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 𝗧𝗼 𝗟𝗲𝗮𝗿𝗻 𝗔𝗜 𝗶𝗻 𝟮𝟬𝟮𝟲🚀 ​ Explore 6 free resource…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →