Python Series | Post 3 Printing in Python We've learned about data types and variables. Now let's talk about how to actually see our results- printing in Python. There are different ways to print in Python, but the most convenient and widely used one is f-strings. Here's how it works: name = 'Rahul' score = 100 subject = 'Mathematics' print(f"Results are out! {name} scored {score} in {subject}.") Output: Results are out! Rahul scored 100 in Mathematics. Simple right? You write f before the inverted commas, type your sentence, and wherever you want a variable to appear, just put it inside { } ⚠️ Pro tip: If you forget the f at the beginning, Python won't substitute your variables. Your output will literally print: "Results are out! {name} scored {score} in {subject}." One small letter, big difference. f-strings are clean, readable and save you a lot of time, especially when working with large datasets as an analyst. What part of printing in Python confused you? Drop it below and I'll simplify it 👇 #Python #DataAnalytics #LearnPython #DataAnalyst #PythonForBeginners
Printing in Python with f-strings
More Relevant Posts
-
Taking input and printing output on console in python:--- Learn = input( "what programming language your learning:") print("Egarly Learning", Learn) Converting string input to number(integers ):- Count = int(input("How many times you want to read python:")) print ("want to read:", Count) if we want to take floating numbers :- temp = float(input ("what is the temperature outside now:")) print("outside temperature is:-", temp) #learn #python #beginner #content #creator #dream
To view or add a comment, sign in
-
Python Learning Journey – 🚀 Today’s focus was on control flow statements that make loops smarter and more efficient. Instead of just running loops, I practised how to control their behaviour using break, continue, and pass. Here’s what I worked on: • Used break to stop execution when a condition is met (sum exceeding a limit) • Used continue to skip specific iterations (printing only odd numbers) • Used 'pass' as a placeholder in conditional statements • Combine break and continue in a real scenario (processing a word list with conditions) These concepts helped me understand how to write more optimised and controlled logic in Python programs. Every day, getting better at thinking logically and writing cleaner code. Big thanks to VASU KUMAR PALANI and PythonLife for the continuous guidance and support. #Python #CodingJourney #LearnInPublic #PythonBasics #Programming #Consistency #TechSkills
To view or add a comment, sign in
-
-
🔁 Understanding Nested Loops in Python (Simple Explanation) If you're learning Python, nested loops are an essential concept to master. 👉 A nested loop means placing one loop inside another loop. 📌 Example: for i in range(2): print(i) for j in range(10, 13): print(j) 💡 How it works: The outer loop runs first. For each iteration of the outer loop, the inner loop runs completely. 🔍 Step-by-step: When i = 0, inner loop runs → prints 10, 11, 12 When i = 1, inner loop runs again → prints 10, 11, 12 ✅ Output: 0 10 11 12 1 10 11 12 🧠 Key Insight: The inner loop executes fully for every iteration of the outer loop. 📌 Think of it like: “For every step I take (outer loop), I repeat another task fully (inner loop).” ✨ Nested loops are widely used in: Pattern printing Matrix operations Data processing #Python #PythonProgramming #LearnPython #Coding #Programming #CodeNewbie #100DaysOfCode #Developer #SoftwareDeveloper #Tech #DataAnalytics #DataScience #Analytics #WomenInTech #CareerGrowth #Upskill #Beginners #CodingJourney #ITCareer
To view or add a comment, sign in
-
-
✓ Advance Python Course with Machine and Deep Learning. ✓ Exercise ( Task 09 ). ✓ Statement:- 1) ----- Write a python program that defines a variable name (my_variable). 2) ----- Following variable naming rules and prints it's value. #LearningInPublic #CodingNewBie #PythonCourse #Programming #FutureGoals #Coding
To view or add a comment, sign in
-
Python Journey — Day 18 | Lambda Functions & Sorting Algorithms Today I explored lambda functions and implemented classic sorting algorithms, which felt like a big step towards core programming concepts. Problems I solved : • Add two numbers using lambda • Find square of a number • Check even or odd using map and lambda • Get last character of a string • Extract values from list of tuples • Filter even numbers from a list • Convert list to squares using map • Find maximum of two numbers • Use reduce with lambda for product • Lambda inside a function Major focus today: • Bubble Sort implementation • Selection Sort implementation I implemented sorting algorithms using pure logic to understand how data is arranged step by step instead of relying on built-in methods. Today's learnings: Understanding lambda functions and anonymous functions Using map and reduce effectively Learning how sorting algorithms work internally Strengthening nested loop concepts through sorting Improving problem-solving with step-by-step logic Today felt important as I started learning core concepts like sorting which are widely used in real applications. On to Day 19 #Python #PythonDeveloper #Programming #Coding #LearningJourney #ProblemSolving #SortingAlgorithms #BubbleSort #SelectionSort #CodeEveryDay #KeepLearning
To view or add a comment, sign in
-
🐍 Python Tip 4: Difference between append() and extend() Many learners get confused between these two list methods. append() Adds the entire object as one element: numbers = [1, 2, 3] numbers.append([4, 5]) print(numbers) Output: [1, 2, 3, [4, 5]] extend() Adds each element individually to the list: numbers = [1, 2, 3] numbers.extend([4, 5]) print(numbers) Output: [1, 2, 3, 4, 5] 💡 Key difference: • append() → adds as a single item • extend() → adds multiple items separately Why this matters? Understanding this helps avoid unexpected list structures, especially while working with datasets or loops. Small concept — but very useful in practice! #Python #PythonTips #Programming #LearnPython #DataScience #CodingTips
To view or add a comment, sign in
-
🚀 Day 7 of Python Learning: Lists in Python Today I learned about Lists — one of the most useful data structures in Python for storing multiple values in a single variable. 🔹 What is a List? A list is a collection of items stored in a single variable. It can store different data types like numbers, strings, etc. 🔸 Creating a List my_list = [1, 2, 3, 4, 5] 🔸 Accessing Elements print(my_list[0]) # First element print(my_list[-1]) # Last element 🔸 Updating List my_list[1] = 10 🔸 Adding Elements my_list.append(6) 🔸 Removing Elements my_list.remove(3) 💡 Key Learning: Lists are mutable, which means we can change their values after creation. 🧪 Practice Task: ✔ Create a list of 5 numbers ✔ Add a new number ✔ Remove one number ✔ Print all elements using a loop 🎯 Interview Question: What is the difference between list and tuple in Python? Answer: "List is mutable (can be changed), while tuple is immutable (cannot be changed)." 📌 Day 7 done — building consistency step by step! #Python #Learning #CodingJourney #Day7 #Programming #SDET #100DaysOfCode Masai #dailylearning, #masaiverse
To view or add a comment, sign in
-
-
🚀 Day 11 of Python Learning: Loops and Patterns in Python Today I practiced loops in Python and learned how to create patterns using nested loops. This helps improve logic building and problem-solving skills. 🔹 What are Patterns? Patterns are shapes or number/star designs created using loops. They are great for understanding loop control and nested loops. 🔸 Using For Loop for i in range(5): print("*") 🔸 Star Pattern Example for i in range(1, 6): print("*" * i) Output: * ** 🔸 Number Pattern Example for i in range(1, 6): for j in range(1, i + 1): print(j, end=" ") print() 💡 Key Learning: Nested loops are useful when one loop runs inside another loop, especially for patterns and matrix-style problems. 🧪 Practice Task: ✔ Print reverse star pattern ✔ Print square pattern using stars ✔ Print number triangle pattern ✔ Try same patterns using while loop 🎯 Interview Question: What is a nested loop in Python? Answer: A nested loop is a loop inside another loop. It is used when repeated iterations are needed within each cycle of the outer loop. 📌 Day 11 completed — logic building step by step! #Python #Learning #CodingJourney #Day11 #Programming #SDET #100DaysOfCode Masai #dailyleaning #masaiverse
To view or add a comment, sign in
-
🐍 Python Tip 3: Use zip() to loop through multiple lists together Sometimes we need to iterate through two lists at the same time. Instead of using indexes: names = ["John", "Emma", "Liam"] scores = [85, 90, 78] for i in range(len(names)): print(names[i], scores[i]) Use zip(): names = ["John", "Emma", "Liam"] scores = [85, 90, 78] for name, score in zip(names, scores): print(name, score) Output: John 85 Emma 90 Liam 78 Why is this helpful? • Cleaner code • Easier to read • Very useful in data analysis Small Python tricks can make coding much more efficient! #Python #PythonTips #Coding #LearnPython #Programming #DataScience #PythonForBeginners #CodingTips
To view or add a comment, sign in
-
🚀 Day 5 of My Python Learning Journey I’ve been consistently learning Python for the past few days, and here’s what I’ve covered so far: ✅ Python Basics (Variables, Input, Data Types) ✅ Conditional Statements ✅ Loops (for, while) ✅ Pattern Problems ✅ Functions & Lambda Functions 💡 Some things I built: Palindrome Checker Prime Number Checker Factorial Calculator Pattern Printing Programs Sum of Digits & Number Reversal 📌 Biggest Learning: Writing logic is more important than just knowing syntax. Small mistakes (like wrong loop conditions) can completely change output. I’m documenting everything on GitHub and improving every day. #Python #LearningInPublic #AI #MachineLearning #CodingJourney
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development