LEARN COMPLETE PYTHON IN 24 HOURS
🟦 Python Basics
🔹 1. Introduction to Python
1.1 What is Python and Why Learn It in 2025?
1.2 Who Uses Python Today?
1.3 Python vs Other Languages
1.4 How to Install Python
1.5 Setting Up VS Code
🔹 2. Basic Building Blocks
🔹 3. Operators in Python
🔹 4. Taking Input & Output
🔹 5. Control Flow (if-else)
🔹 6. Loops in Python
🔹 7. Lists
🔹 8. Tuples
🔹 9. Strings (Deep Dive)
🔹 10. Dictionaries
🔹 11. Sets
🔹 12. Functions
🔹 13. Modules & Packages
🔹 14. Mini Projects
4. Taking Input & Showing Output
In Python, showing output to the user and taking input from them are the most common ways programs interact with people. The two main functions are print() and input().
4.1 print() – All Important Ways to Use It
print() displays text, numbers, variables, or anything on the screen (console/terminal).
Basic Syntax:
Python
print(value1, value2, ..., sep=' ', end='\n')
Key Parameters:
sep → separator between values (default: space ' ')
end → what to print at the end (default: new line \n)
Examples – From Basic to Advanced:
Simple print
Python
print("Hello, World!") # Hello, World! print(100) # 100 print(True) # True
Print multiple values
Python
name = "Anshuman" age = 25 print("Name:", name, "Age:", age) # Output: Name: Anshuman Age: 25
Change separator (sep)
Python
print("Python", "is", "fun", sep="---") # Output: Python---is---fun
Change end (no new line)
Python
print("Hello", end=" ") # No new line print("World!") # Continues on same line # Output: Hello World!
Print special characters
Python
print("Line 1\nLine 2") # New line print("Tab\tHere") # Tab space print("Escape \"quotes\"") # Print quotes
Print variables with commas (old style)
Python
marks = 98 print("You scored", marks, "out of 100") # You scored 98 out of 100
Tip: print() automatically adds a space between items and a new line at the end — very convenient!
4.2 input() – Getting Data from User
input() pauses the program and waits for the user to type something and press Enter.
Syntax:
Python
variable = input("Prompt message: ")
Important: input() always returns a string (even if user types a number).
Examples:
Basic input
Python
name = input("Enter your name: ") print("Hello,", name, "!")
Sample run:
text
Enter your name: Anshuman Hello, Anshuman !
Taking number (but remember — it's string)
Python
age = input("Enter your age: ") print("You are", age, "years old") # If user types 25 → You are 25 years old (but age is string!)
Convert input to number (very common)
Python
age = int(input("Enter your age: ")) # Convert to integer height = float(input("Enter your height in cm: ")) # Convert to float print("Next year you will be", age + 1, "years old") print("Your height in meters:", height / 100)
Sample run:
text
Enter your age: 25 Enter your height in cm: 170.5 Next year you will be 26 years old Your height in meters: 1.705
Multiple inputs in one line
Python
# User types: 10 20 30 numbers = input("Enter 3 numbers separated by space: ").split() print("You entered:", numbers) # ['10', '20', '30']
Warning: If user enters wrong type → error on conversion! Example: int("abc") → ValueError Solution: Use try-except later (advanced topic).
Tip for beginners: Always convert input() when you expect numbers:
Python
marks = int(input("Enter marks: "))
4.3 Formatting Output (f-strings, .format(), % operator)
There are 3 main ways to format (make beautiful) output in Python.
1. f-strings (Recommended – Python 3.6+) – Easiest & Fastest
Python
name = "Anshuman" age = 25 city = "Muzaffarpur" print(f"My name is {name}, I am {age} years old, from {city}.") # My name is Anshuman, I am 25 years old, from Muzaffarpur.
Advanced f-string tricks:
Python
price = 999.99 print(f"Price: ₹{price:.2f}") # Price: ₹999.99 (2 decimal places) percentage = 78.456 print(f"Score: {percentage:.1f}%") # Score: 78.5% today = "2026" print(f"Welcome to Python in {today:^20}!") # Center align # Welcome to Python in 2026 !
2. .format() method – Still used a lot
Python
name = "Anshuman" age = 25 print("My name is {}, I am {} years old.".format(name, age)) # My name is Anshuman, I am 25 years old. print("Hello {0}, welcome back {0}! You are {1} now.".format(name, age)) # Hello Anshuman, welcome back Anshuman! You are 25 now.
3. % operator (Old style – Avoid in new code)
Python
name = "Anshuman" marks = 98.5 print("Name: %s, Marks: %.1f" % (name, marks)) # Name: Anshuman, Marks: 98.5
Comparison Table (Quick Guide):
MethodSyntax ExampleBest ForModern?f-stringsf"Hello {name}"Everyday use, clean & fastYes (2016+).format()"Hello {}".format(name)Older code, dynamic stringsYes% operator"Hello %s" % nameVery old codeNo
Recommendation for 2026: Always use f-strings — they are the most readable and fastest.
Mini Project Example – Combining print + input + formatting
Python
name = input("What is your name? ") age = int(input("How old are you? ")) print("-" 40) print(f"Welcome, {name.upper()}!") print(f"You are {age} years old → Next birthday: {age + 1}") print(f"Enjoy learning Python in {2026} 🎉") print("-" 40)
Sample Output:
text
What is your name? Anshuman How old are you? 25 ---------------------------------------- Welcome, ANSHUMAN! You are 25 years old → Next birthday: 26 Enjoy learning Python in 2026 🎉 ----------------------------------------
This completes the full Taking Input & Showing Output section.
📚 Amazon Book Library
All my books are FREE on Amazon Kindle Unlimited🌍 Exclusive Country-Wise Amazon Book Library – Only Here!
On GlobalCodeMaster.com you’ll find complete, ready-to-use lists of my books with direct Amazon links for every country.
Belong to India, Australia, USA, UK, Canada or any other country? Just click your country’s link and enjoy:
✅ Any eBook FREE on Kindle Unlimited ✅ Or buy at incredibly low prices
400+ fresh books written in 2025-2026 with today’s latest AI, Python, Machine Learning & tech trends – nowhere else will you find this complete country-wise collection on one platform!
Choose your country below and start reading instantly 🚀
BOOK LIBRARY USA 2026 LINK
BOOK LIBRARY INDIA 2026 LINK
BOOK LIBRARY AUSTRALIA 2026 LINK
BOOK LIBRARY CANADA 2026 LINK
BOOK LIBRARY UNITED KINGDOM 2026 LINK
BOOK LIBRARY GERMANY 2026 LINK
BOOK LIBRARY FRANCE 2026 LINK
BOOK LIBRARY ITALY 2026 LINK
BOOK LIBRARY SPAIN 2026 LINK
BOOK LIBRARY NETHERLANDS 2026 LINK
BOOK LIBRARY BRAZIL 2026 LINK
BOOK LIBRARY MEXICO 2026 LINK
BOOK LIBRARY JAPAN 2026 LINK
BOOK LIBRARY POLAND 2026 LINK
BOOK LIBRARY IRELAND 2026 LINK
BOOK LIBRARY SWEDEN 2026 LINK
BOOK LIBRARY BELGIUM 2026 LINK
Email-ibm.anshuman@gmail.com
© 2026 CodeForge AI | Privacy Policy |Terms of Service | Contact | Disclaimer | 1000 university college list|book library australia 2026|Latest AI Trends (Global & India 2026) 400 GLOBAL BOOK STORE WORLDWID|TOP 400 FREE BOOK LIBRARY USA|TOP 400 FREE BOOK LIBRARY INDIA|Audiobooks at Just ₹99 | $1.25| E-Books at Just ₹49 | $0.50| 50+ AI Expert Tutorials
All my books are exclusively available on Amazon. The free notes/materials on globalcodemaster.com do NOT match even 1% with any of my PUBLISHED BOoks. Similar topics ≠ same content. Books have full details, exercises, chapters & structure — website notes do not.No book content is shared here. We fully comply with Amazon policies.
🚀 Best content for SSC, CGL, LDC, TET, NET & SET preparation!
📚 Maths | Reasoning | GK | Previous Year Questions | Tips & Tricks
👉 Join our WhatsApp Channel now:
🔗 https://whatsapp.com/channel/0029Vb6kg2vFnSz4zknEOG1D...