Python Programming
2.7M subscribers
About Python Programming
Perfect channel to learn Python Programming ๐จโ๐ป๐ฉโ๐ป Download Free Books & Courses to master Python Programming - โ Free Courses - โ Coding Projects - โ Important Pdfs - โ Artificial Intelligence Bootcamps - โ Data Science Notes - โ Latest Tech & AI Trends For promotions, contact [email protected] This channel is for Python Programmers. 0๏ธโฃ Python Basics 1๏ธโฃ Data Types & Variables 2๏ธโฃ Control Flow (if, for, while) 3๏ธโฃ Functions & Modules 4๏ธโฃ File Handling 5๏ธโฃ Object-Oriented Programming 6๏ธโฃ Error Handling 7๏ธโฃ Libraries (NumPy, Pandas, etc.) 8๏ธโฃ Projects & Practice Python can be used for โ Data Science โ Machine Learning โ Web Development โ Automation & Scripting โ Game Development โ Artificial Intelligence โ Cybersecurity โ Desktop App Development โ Data Analysis & Visualization โ Internet of Things (IoT) โ Natural Language Processing (NLP) โ Backend API Development โ Finance & Quantitative Analysis โ Blockchain Prototyping โ Scientific Computing ๐ Tech Experts from All Over the World Are Here! ๐ ๐ฎ๐ณ India ๐จ๐ณ China ๐บ๐ธ United States ๐ฎ๐ฉ Indonesia ๐ต๐ฐ Pakistan ๐ณ๐ฌ Nigeria ๐ง๐ท Brazil ๐ง๐ฉ Bangladesh ๐ท๐บ Russia ๐ช๐น Ethiopia ๐ต๐ญ Philippines ๐ฒ๐ฝ Mexico ๐ฏ๐ต Japan ๐ช๐ฌ Egypt ๐ป๐ณ Vietnam ๐จ๐ฉ DR Congo ๐น๐ท Turkey ๐ฎ๐ท Iran ๐ฉ๐ช Germany ๐น๐ญ Thailand ๐ฌ๐ท United Kingdom ๐ฎ๐ถ Iraq ๐ฟ๐ฆ South Africa ๐ฒ๐พ Malaysia ๐บ๐ฆ Ukraine ๐ฐ๐ท South Korea ๐ท๐ด Romania ๐จ๐ด Colombia ๐ง๐ช Belgium ๐ฎ๐ฑ Israel ๐ฆ๐บ Australia ๐ฒ๐ป Myanmar ๐ฐ๐ช Kenya ๐ธ๐ฆ Saudi Arabia ๐ฆ๐ท Argentina ๐บ๐ฟ Uzbekistan ๐ณ๐ฑ Netherlands ๐ซ๐ท France ๐ฒ๐พ Malaysia ๐ธ๐พ Syria ๐ช๐จ Ecuador ๐ต๐ฑ Poland ๐ฉ๐ด Dominican Republic ๐บ๐พ Uruguay ๐ช๐ธ Spain ๐ฎ๐น Italy ๐ฉ๐ฐ Denmark ๐ธ๐ฎ Slovenia ๐ฒ๐ฐ North Macedonia ๐ฑ๐ป Latvia ๐ฑ๐น Lithuania ๐ณ๐ด Norway ๐ง๐ฌ Bulgaria ๐ช๐ช Estonia
Similar Channels
Swipe to see more
Posts
What does the following function return? def check(x): if x > 5: return True print(check(3))
Which of the following is a correct way to call this function? def greet(name): print("Hello", name)
What will be the output of this code? def greet(name, msg="Welcome!"): print(name, msg) greet("Sam")
*Here are the Answers for the previous quizzes* โ *Q1. What keyword is used to define a function in Python?* โ *Answer: C. def* The def keyword is used to define a function in Python. Example: def greet(): *Q2. What is the output of this code?* def add(a, b): return a + b print(add(3, 4)) โ *Answer: A. 7* The function returns 3 + 4, which is 7, and print() displays it. *Q3. What happens if a function has no return statement?* โ *Answer: B. It returns None* All functions in Python return None by default if thereโs no return statement. *Q4. Which of the following is a correct way to call this function?* def greet(name): print("Hello", name) โ *Answer: B. greet("Alice")* The function expects one parameter, and "Alice" is passed correctly. *Q5. What does the following function return?* def check(x): if x > 5: return True print(check(3)) โ *Answer: C. None* Since 3 is not greater than 5, the condition fails and thereโs no return value โ so Python returns None. *React with โค๏ธ if you're ready for the next topic* Python Coding Challenge: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L/1661
What is the output of this code? def add(a, b): return a + b print(add(3, 4))
Today, Letโs move on to the next topic in the Python Coding Challenge: ๐น *Day 9: Function Arguments in Python* ๐ค *Why are Arguments Important?* Arguments allow us to pass data into a function so it can act on different values โ making the function dynamic instead of static. โ *Types of Function Arguments* *1. Positional Arguments* These are the most common โ the order matters. ```def greet(name, age): print(f"{name} is {age} years old.") greet("Alex", 25) ``` *2. Keyword Arguments* You specify the name of the argument, so order doesnโt matter. greet(age=25, name="Alex") *3. Default Arguments* Provide a default value so the argument becomes optional. ```def greet(name, city="Delhi"): print(f"{name} is from {city}") greet("Riya") # Uses default city greet("Riya", "Mumbai") # Overrides default ``` *4. Variable-length Arguments* *args for multiple positional values (tuple) **kwargs for multiple keyword values (dictionary) ``` def total(*numbers): return sum(numbers) print(total(2, 4, 6)) # Outputs: 12 def display_info(**data): for key, value in data.items(): print(f"{key} = {value}") display_info(name="John", age=30) ``` ๐จ *Mini Project: Tip Calculator with Tax* ``` def calculate_total(bill, tip_percent=10, tax_percent=5): tip = bill * (tip_percent / 100) tax = bill * (tax_percent / 100) return bill + tip + tax amount = float(input("Enter bill amount: ")) total_amount = calculate_total(amount, tip_percent=15) print(f"Total Amount to Pay: โน{total_amount:.2f}") ``` ๐ง This project demonstrates: - Positional and default arguments - Mathematical logic - Function flexibility *React with โค๏ธ once youโre ready for the quiz* Python Coding Challenge: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L/1661
What is the correct way to define a function with default values?
What does *args allow you to do in a function?
What happens if a function has no return statement?
What keyword is used to define a function in Python?