Posts

Showing posts from October, 2025

Quiz : pass, continue, break, and else in Python

Quiz: pass, continue, break, and else in Python Quiz: Loop Manipulation using pass , continue , break and else in Python 15 multiple-choice questions. Choose the best option. Click Submit to see your score and explanations. Use Reset to try again. 1. What does the pass statement do inside a loop? Immediately exits the loop Does nothing (placeholder) and continues Skips to the next iteration Raises an exception 2. Which statement skips the current iteration and moves to the next? pass break continue return 3. What happens when break is executed in a loop? Skips remaining code and continues next iteration Exits the loop immediately Causes the loop to restart from the first iteration ...

Topic11: Pass, continue, break, and else in Python?

Loop Manipulation Using pass , continue , break , and else in Python In Python, loops are used to execute a block of code repeatedly until a specific condition is met. However, sometimes we need more control over how the loop behaves  for example, to skip certain iterations, stop the loop early, or execute a block after the loop ends. Python provides loop manipulation statements like pass , continue , break , and else to make loops flexible and powerful. 1. The pass Statement The pass statement does nothing,   it’s a placeholder that helps maintain syntactic correctness when a statement is required but no action is needed. Example: for i in range(5): if i == 3: pass # No action taken else: print("Value:", i) Output: Value: 0 Value: 1 Value: 2 Value: 4 Explanation: When i == 3 , Python executes pass and moves to the next iteration without doing anything. 2. The continue Statement The continue statement skips the remaining code ...

Test your knowlege about string

Python String Quiz Python String Quiz (15 MCQs) 1. Which of the following is a valid string in Python? "Hello World" Hello World 'Hello World" 2. What is the output of len("Python") ? 5 6 7 3. What will "Hi" * 3 return? Hi3 HiHiHi Error 4. Strings in Python are: Mutable Immutable None 5. What will "Python".lower() output? python PYTHON Python 6. Which operator is used for concatenation? + * & 7. What does "Hello".find("e") return? 0 1 2 8. Which of the following checks if substring exists? if "sub" exist "string" "sub" in "string" "string" in "sub" 9. What will "Python Programming".split() return? ['Python', 'Programming'] ['Python Programming'] ['P','y...

Topic 12: String Data Type in Python?

Image
👈 Previous Topic                                                                                    String Quiz  Next 👉    String Data Type                                                                     (Reading time   7-10minutes) In Python, a string is a sequence of characters enclosed within single quotes (‘ ’), double quotes (“ ”), or even triple quotes (‘’’ ’’’ or “”” “””). Strings are one of the most commonly used data types because they help store and manipulate textual information  such as names, messages, or file paths. Example: ...

Quiz for loops

Python Loops Quiz Python Loops Quiz 1. What is a loop in Python? A structure that repeats code A Python library A type of variable None of these 2. Which keyword is used for loops in Python? loop iterate for repeat 3. What does the while loop do? Repeats code while condition is true Runs once Stops program None of the above 4. What is the output of: for i in range(3): print(i) 1 2 3 0 1 2 0 1 2 3 Error 5. What does range(2, 10, 2) produce? 2, 4, 6, 8 2, 4, 6, 8, 10 1, 2, 3, 4 Error 6. What does the break statement do? Skips one iteration Stops the loop completely Restarts the loop Does nothing 7. What does the continue statement do? Exits the loop Skips current iteration ...

Topic 10: What are Loops in Python?

  What are Loops in Python?                               Quiz for Loop s 👉 (Reading Time 5-7minutes) In programming, loops are an essential concept that allows you to repeat a block of code multiple times . In Python, loops help reduce repetition and make programs more efficient and readable. Instead of writing the same code again and again, loops let the computer do the repetition automatically.A loop is a programming structure that lets you repeat a block of code multiple times  as long as a condition is true or for a specific number of iterations. A loop is a control structure that executes a group of statements repeatedly as long as a given condition is true. When the condition becomes false, the loop stops executing. Example: print("Hello") print("Hello") print("Hello") Instead of writing this three times, you can use a loop: for i in range(3): print("Hello") Python supports mainly...

Emerging Technologies: Artificial intellegence (AI), Machine Learning (ML) and Deep Learning (DL)

Image
  1. Artificial Intelligence (AI) Artificial Intelligence (AI) is one of the most powerful and transformative technologies of the modern era. It refers to the ability of machines to think, learn, and act like humans . Through AI, computers can perform tasks that normally require human intelligence such as reasoning, problem-solving, decision-making, and understanding natural language. Artificial Intelligence is a branch of computer science that aims to create intelligent machines . It combines algorithms, data, and computing power to enable systems to simulate human thinking and behavior.  AI systems can analyze information, learn from experience, and improve their performance over time — much like how humans learn from practice. Applications of Artificial Intelligence AI is revolutionizing almost every field of life. Some major applications include: Healthcare: Disease prediction, robotic surgeries, and drug discovery. Education: Personalized learning tools and...

Pandas quiz (15 MCQ)

Pandas MCQ Quiz Pandas MCQ Quiz 1. What is Pandas mainly used for? Game development Data manipulation and analysis Web design Mobile app creation 2. Which data structure in Pandas is 1-dimensional? DataFrame Series Matrix List 3. Pandas is built on top of which Python library? TensorFlow NumPy Matplotlib SciPy 4. Which function reads data from a CSV file? pd.read_file() pd.load_csv() pd.read_csv() pd.open_csv() 5. What does df.head() do? Displays the last rows Displays first few rows Sorts the DataFrame Deletes rows 6. What is the default number of rows shown by df.head()? 3 5 10 ...

Topic 9: What is Pandas?

Image
 What is need of pandas?                                                   Pandas Quiz 👉 (Reading time 7-10 minutes) Pandas is an open-source Python library designed for data manipulation, analysis, and cleaning. It offers powerful data structures such as Series for 1-dimensional data and DataFrame for 2-dimensional tabular data. Built on top of NumPy , Pandas ensures fast and efficient performance for large datasets. It simplifies tasks like data filtering, transformation, aggregation, and visualization. Pandas supports reading and writing data from multiple sources, including CSV, Excel, and SQL. Its intuitive syntax allows users to handle missing data and perform complex operations easily. Overall, Pandas is an essential tool for data science, analytics, and machine learning workflows. Diagram: Pandas Workflow Need Pandas? Wi...

Numpy Quiz (Total-15 questions)

15 NumPy MCQs 15 NumPy MCQs — Interactive Quiz Choose one answer per question and click Submit . Submit Reset AD