0% found this document useful (0 votes)
21 views21 pages

Python Programming Basics Quiz

The document is a model question paper for a course on Artificial Intelligence and Machine Learning, specifically focusing on Python programming. It contains multiple-choice questions covering various topics such as data types, control structures, functions, and data structures in Python. Each question includes options and the correct answer indicated.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views21 pages

Python Programming Basics Quiz

The document is a model question paper for a course on Artificial Intelligence and Machine Learning, specifically focusing on Python programming. It contains multiple-choice questions covering various topics such as data types, control structures, functions, and data structures in Python. Each question includes options and the correct answer indicated.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

15/10/2025, 19:02 Model Question Paper (Preview)

1056 — Artificial Intelligence (Ai) And Machine Learning


Introduction To Python Programming (1056233110)
Part A — 1 mark(s) each
Unit 1
1. Why is Python considered portable?
a) Because it runs on specific OS only
b) Because it can run on different OS with modification
c) Because it needs machine-specific code
d) Because it can run on different OS without modification
Answer: D
2. 7. Which operator is more efficient for checking object identity?
a) ==
b) is
c) in
d) :=
Answer: B
3. Which result will 3 > 2 and 5 < 10 return?
a) True
b) False
c) Error
d) None
Answer: A
4. What will x = input("Enter: ") store if user enters 100?
a) int 100
b) str "100"
c) float 100.0
d) 100
Answer: B
5. Which of the following is a valid identifier?
a) 1var
b) for
c) _value
d) var-name
Answer: C
6. Which symbol is used for comments in Python?
a) //
b) /* */
d) <!-- -->

[Link] 1/21
15/10/2025, 19:02 Model Question Paper (Preview)

7. What happens when python3is entered in the terminal?


a) Opens Python interactive mode
b) Compiles a program
c) Opens a text editor
d) Opens Python Script mode
Answer: A
8. Which of these is immutable?
a) List
b) Dictionary
c) Tuple
d) Set
Answer: C
9. If a = "5", what will a*3 return in python?
a) 15
b) 555
c) Error
d) 53
Answer: B
10. Which symbol represents the Python interactive prompt?
a) >>
b) >>>
Answer: B
11. In Python, everything is
a) Function
b) Method
c) Object
d) Variable
Answer: C
12. Which of the following data type is mutable?
a) Tuple
b) String
c) List
d) int
Answer: C
13. Which is NOT a valid string operation in Python?
a) Concatenation
b) Multiplication
c) Subtraction
d) Slicing
Answer: C
[Link] 2/21
15/10/2025, 19:02 Model Question Paper (Preview)

14. Which operator is used for floor division?


a) //
d) **
Answer: A
15. What does int("10") + float("20.5") return?
a) "1020.5"
b) Error
c) 10.20.5
d) 30.5
Answer: D
16. x = 5; x += 3 results in:
b) 53
c) Error
d) None
17. What is the output of type(10.0)?
a) float
b) int
c) double
d) decimal
Answer: A
18. Which of the following function is used to take input as string in python 2?

a) get_input()
b) input()
c) str_input()
d) raw_input()
Answer: D
19. Which of the following is NOT a feature of Python?
a) Interpreted and Compiled
b) Compiled only
c) Dynamically typed
d) High-level language
Answer: B

20. Which of the following would you choose to store unique student roll numbers?
a) Set
b) Tuple
c) Dictionary values
d) List
Answer: A
Unit 2
[Link] 3/21
15/10/2025, 19:02 Model Question Paper (Preview)

1. If a loop contains both break and continue, which takes precedence if both execute in the
same iteration?
a) break
b) continue
c) pass
d) none
Answer: A
2. What is the correct syntax of a simple if statement in Python?
a) if (x > 5):
b) if x > 5 { }
c) if x > 5 then
d) if x > 5 end
Answer: A
3. Which keyword is used to define a function?
a) func
b) function
c) define
d) def
Answer: D

4. Which function generates a sequence of numbers in Python loops?


a) seq()
b) range()
c) loop()
d) list()
Answer: B
5. What is the Output of the following code?
for i inrange(1,5):
print(i,end=" ")
a) 1 2 3 4 5
b) 1 2 3 4
c) 0 1 2 3 4
d) Error
Answer: B

6. If you want to compute sum of squares of numbers in a list, which approach is most
Pythonic?
a) for loop
b) while loop
c) add(map(lambda x: xx, list))
d) sum(map(lambda x: xx, list))
Answer: D

[Link] 4/21
15/10/2025, 19:02 Model Question Paper (Preview)

7. Which keyword defines anonymous functions?


a) def
b) lambda
c) func
d) anon
Answer: B
8. Which loop is better suited when the number of iterations is unknown?
a) for loop
b) while loop
c) both
d) none
Answer: B
9. Which function returns the square root?
a) sqrt()
b) square()
c) pow()
d) root()
Answer: A
10. What does help(str) display?
a) String documentation
b) String values
c) String length
d) String values and String length
Answer: A

11. A function that calls itself is called


a) Recursive function
b) Inline function
c) Lambda function
d) Generator function
Answer: A
12. What will be the output of the following code?
for i inrange(3):
pass
print("Done")
a) Nothing
b) Done
c) Error
d) Infinite loop
Answer: B
13. What is the default return value of a function without return statement?
[Link] 5/21
15/10/2025, 19:02 Model Question Paper (Preview)

b) False
c) Error
d) None
Answer: D
14. Which loop would you prefer for iterating a fixed-size list?
a) for
b) while
c) recursion
d) all equal
Answer: A
15. In an if…elif…else chain, how many blocks get executed?
a) All blocks
b) None
c) At most one block
d) At least two blocks
Answer: C
16. If a function inside another function is required, this concept is known as
a) Recursive function
b) Generator
c) Lambda
d) Nested function
Answer: D
17. If both local and global variables exist with the same name, which is given priority inside the
function?
a) Global
b) Local
c) Both
d) None
Answer: B

18. What is the output of the following code?


deff():
x = 10
return x
print(x)
a) NameError (x not defined)
b) Error (x is defined)
c) 10
d) 100
Answer: A
19. What will be the output of the following Python code?
[Link] 6/21
15/10/2025, 19:02 Model Question Paper (Preview)

f = lambda x: x+2
print(f(5))
b) Error
20. Which module provides mathematical functions?
a) random
b) math
c) sys
d) os
Answer: B
Unit 3
1. Which method returns the index of first occurrence of an element?
a) find()
b) locate()
c) index()
d) position()
Answer: C
2. Which method is best to remove extra spaces from beginning and end of a string?
a) strip()
b) trim()
c) cut()
d) remove()
Answer: A
3. What is the output for the below code?
a = [1,2,3]
a[1] = 5
print(a)
a) [1,2,3]
b) [1,5,3]
c) Error
d) None
Answer: B
4. Which method creates a shallow copy of a list?
a) copy()
b) deepcopy()
c) clone()
d) slice()
Answer: A
5. Which escape sequence represents a tab?
a) \n
b) \r
[Link] 7/21
15/10/2025, 19:02 Model Question Paper (Preview)

d) \t
Answer: D
6. "hello".replace("l","x") gives
a) hexxo
b) hexxox
c) hexx
d) hxllo
Answer: A

7. "Python".find("th") returns
c) -1
d) None
8. Which operator checks membership in a list?
a) in
b) ==
c) is
d) has
Answer: A
9. Which will throw an error?
a) "Hello"[0]
b) "Hello"[-1]
c) "Hello"[5]
d) "Hello"[1:3]
Answer: C

10.
a = [1,2,3]
print([Link]())
Output of the above code is

d) Error
11. Strings in Python are enclosed in
a) Single quotes only
b) Double quotes only
c) Either single or double quotes
d) None
Answer: C
12. Consider two lists list1 and list2. Which is used to merge two lists without duplicates?
a) list1 + list2
b) append()
c) extend()

[Link] 8/21
15/10/2025, 19:02 Model Question Paper (Preview)

d) set(list1+list2)
Answer: D
13. Strings in Python are

a) Mutable
b) Immutable
c) Both
d) None
Answer: B
14. Which list operation is more efficient for adding element at end?
a) append()
b) insert()
c) extend()
d) add()
Answer: A
15. Which method sorts a list in place?
a) sorted()
b) order()
c) arrange()
d) sort()
Answer: D
16. What is the output?
s=abc
for ch in s:
print(ch, end="-")

a) abc-
b) a-b-c-
c) a-b-c
d) Error
Answer: B
17. Which index refers to the last element in a list?
c) -1
d) None
Answer: C
18. Output of "hello world".title() is
a) Hello world
b) Hello World
c) Hello world!
d) Error
[Link] 9/21
15/10/2025, 19:02 Model Question Paper (Preview)

Answer: B
19. Which method returns the string in uppercase?
a) cap()
b) toUpper()
c) up()
d) upper()
Answer: D
20. Which method checks if all characters are digits?
a) isnum()
b) isdecimal()
c) isnumeric()
d) isdigit()
Answer: D
Unit 4
1. Which statement is correct?
a) Dictionary keys can be duplicated
b) Dictionary keys must be unique
c) Dictionary values must be unique
d) Both keys and values must be unique
Answer: B
2. What will be the output of the following code?
d = {"x":1,"y":2}
d["y"]=3
print(d)
a) {"x":1,"y":2}
b) {"y":3}
c) {"x":1,"y":3}
d) Error
Answer: C
3. Why are dictionary keys required to be immutable?
a) For speed
b) To save memory
c) To allow hashing
d) None
Answer: C
4. Output of below code is
d = {"a":1, "b":2}
print(d["a"])
c) Error
5. Which data structure is most suitable for mapping countries to their capitals?
[Link] 10/21
15/10/2025, 19:02 Model Question Paper (Preview)

a) List
b) Set
c) Tuple
d) Dictionary
Answer: D
6. Which symbol is used for dictionary?
a) []
b) ()
c) <>
d) {}
Answer: D
7. Output of the following code
d = {"a":1, "b":2}
print("a" in d)

c) True
d) Error
Answer: C
8. What is the type of (5,) in Python?
a) int
b) tuple
c) list
d) set
Answer: B
9. If tuple t = (1,2,[3,4]), what is mutable here?
a) List inside tuple
b) Whole tuple
c) Integers
d) The tuple t itself
Answer: A
10. Which data structure is most commonly used to return multiple values from a Python
function?
a) Tuple
b) List
c) Dictionary
d) String
Answer: A
11. Which statement is true?
a) Tuples can be nested
b) Tuples cannot contain lists
[Link] 11/21
15/10/2025, 19:02 Model Question Paper (Preview)

c) Tuples cannot be indexed


d) Tuples are always ordered randomly
Answer: A
12. Dictionaries store data as
a) Key-value pairs
b) Single values
c) Indexed elements
d) Immutable pairs
Answer: A
13. Dictionary keys must be
a) Mutable
b) Immutable
c) Strings only
d) Integers only
Answer: B
14. How do you swap values in Python?
a) temp = a; a=b; b=temp
b) a,b = b,a
c) swap(a,b)
d) None
Answer: B
15. Which is better for storing student roll no. and name? (Evaluate)
a) List
b) Tuple
c) Set
d) Dictionary
Answer: D
16. Which is more memory efficient?
a) List
b) Both same
c) Tuple
d) None
Answer: C
17. Tuples are faster than lists because
a) They are mutable
b) They are immutable
c) They store only integers
d) None
Answer: B
18. How do you swap values in Python?
[Link] 12/21
15/10/2025, 19:02 Model Question Paper (Preview)

a) temp = a; a=b; b=temp


b) a,b = b,a
c) swap(a,b)
d) None
Answer: B
19. Which deletes all items from dictionary?
a) delete()
b) reset()
c) clear()
d) empty()
Answer: C
20. Which operation is invalid in tuples?
a) Indexing
b) Concatenation
c) Assignment
d) Iteration
Answer: C
Unit 5
1. Default file mode if not specified is:
a) "w"
b) "a"
c) "r"
d) None
Answer: C
2. Which method returns file contents as a list of lines?
a) readlines()
b) readline()
c) list()
d) tolist()
Answer: A

3. Which module is used for directory operations?


a) os
b) sys
c) dir
d) path
Answer: A
4. Which method deletes a directory?

a) deldir()
b) removedir()

[Link] 13/21
15/10/2025, 19:02 Model Question Paper (Preview)

c) erase()
d) rmdir()
Answer: D
5. Which block is mandatory in exception handling?
a) except
b) finally
c) try
d) None
Answer: C
6. Which method creates a new directory?
a) create()
b) mkdir()
c) newdir()
d) makedir()
Answer: B
7. Which keyword is used to raise an exception manually?
a) throw
b) except
c) error
d) raise
Answer: D
8. Which keyword is used to handle multiple exception types?
a) except (list)
b) multiple
c) except (tuple)
d) raise
Answer: C
9. Which is the best way to handle predictable errors?
a) Single except block
b) Multiple except blocks
c) Generic except block
d) Raise always
Answer: B
10. Which is correct way to handle multiple exceptions?
a) except (ValueError, ZeroDivisionError):
b) except ValueError or ZeroDivisionError:
c) except [ValueError, ZeroDivisionError]:
d) except: ValueError, ZeroDivisionError
Answer: A
11. Which block executes regardless of exception?
[Link] 14/21
15/10/2025, 19:02 Model Question Paper (Preview)

a) except
b) else
c) finally
d) try
Answer: C
12. Which returns the current working directory?
a) getdir()
b) pwd()
c) dirpath()
d) getcwd()
Answer: D
13. What happens if you try to read from a closed file?
a) Error
b) Returns ""
c) None
d) Opens automatically
Answer: A
14. What is the output?
f = open("[Link]","w")
[Link]("Hi")
[Link]()
f = open("[Link]","r")
print([Link]())

a) Nothing
b) Hi
c) Error
d) iH
Answer: B
15. What happens if you open a file in "w" mode?
a) File is deleted
b) File is opened without change
c) File is truncated (content created)
d) File is truncated (content erased)
Answer: D
16. Which module is used for directory operations?
a) os
b) sys
c) dir
d) path
[Link] 15/21
15/10/2025, 19:02 Model Question Paper (Preview)

Answer: A
17. What will happen if you use rmdir() on a non-empty directory?
a) Deletes all files inside
b) Throws an error
c) Removes directory only
d) Raise an error
Answer: B
18. What will happen?
try:
print(10/0)
except ZeroDivisionError:
print("Div by zero")
a) Error
b) Div by zero
c) Nothing
d) Crashes
Answer: B
19. Which mode is used to append data to an existing file?
a) "r"
b) "w"
c) "a"
d) "rw"
Answer: C
20. What happens if you try to read the content from a closed file?
a) Returns ""
b)
ValueError

c) Opens automatically
d) Nameerror
Answer: B
Part B — 2 mark(s) each
Unit 1
1. Differentiate between input() and raw_input() functions.
Answer: Differentiate between input() and raw_input() functions.
2. What is the purpose of comments in Python?
Answer: What is the purpose of comments in Python?
3. List any four features of python
Answer: List any four features of python

[Link] 16/21
15/10/2025, 19:02 Model Question Paper (Preview)

4. Write a Python expression to calculate the area of a circle with radius r.


Answer: Write a Python expression to calculate the area of a circle with radius r.
5. Justify why Python is considered better for rapid application development compared to C.
Answer: Justify why Python is considered better for rapid application development compared
to C.
6. Compare logical operators and, or, and not with examples.
Answer: Compare logical operators and, or, and not with examples.
7. Why is Python called dynamically typed?
Answer: Why is Python called dynamically typed?
8. Write short notes on mutable and immutable objects with an example.
Answer: Write short notes on mutable and immutable objects with an example.
9. Convert the string "123" into an integer using a Python function.
Answer: Convert the string "123" into an integer using a Python function.
10. Write any four reserved keywords in Python.
Answer: Write any four reserved keywords in Python.
Unit 2
1. List any four mathematical built-in functions in Python.
Answer: List any four mathematical built-in functions in Python.
2. Explain the purpose of the range() function in loops.
Answer: Explain the purpose of the range() function in loops.
3. Why do we use the pass statement in Python?
Answer: Why do we use the pass statement in Python?
4. Define recursion in Python.
Answer: Define recursion in Python.
5. Demonstrate the use of an anonymous (lambda) function to add two numbers.
Answer: Demonstrate the use of an anonymous (lambda) function to add two numbers.
6. What is the syntax of a simple if statement in Python?
Answer: What is the syntax of a simple if statement in Python?
7. Compare the use of for loop and while loop with examples.
Answer: Compare the use of for loop and while loop with examples.
8. Show how to use the while loop to print numbers from 1 to 5.
Answer: Show how to use the while loop to print numbers from 1 to 5.
9. What is the purpose of the dir() function?
Answer: What is the purpose of the dir() function?
10. Evaluate why break and continue are considered important for loop control.
Answer: Evaluate why break and continue are considered important for loop control.
Unit 3

[Link] 17/21
15/10/2025, 19:02 Model Question Paper (Preview)

1. Define list.
Answer: Define list.
2. What is meant by the immutable property of strings?
Answer: What is meant by the immutable property of strings?
3. Justify why lists are more flexible than strings in Python programming.
Answer: Justify why lists are more flexible than strings in Python programming.
4. Explain copying list.
Answer: Explain copying list.
5. What is the purpose of the built-in len() function for lists?
Answer: What is the purpose of the built-in len() function for lists?
6. Explain how escape characters work in strings. Give two examples.
Answer: Explain how escape characters work in strings. Give two examples.
7. Write the syntax to create a list in Python.
Answer: Write the syntax to create a list in Python.
8. Write Python code to copy one list into another using slicing.
Answer: Write Python code to copy one list into another using slicing.
9. What are strings in Python?
Answer: What are strings in Python?
10. List any four string methods in Python.
Answer: List any four string methods in Python.
Unit 4
1. Why are dictionary keys required to be immutable in Python?
Answer: Why are dictionary keys required to be immutable in Python?
2. List any four dictionary methods.
Answer: List any four dictionary methods.
3. What is a tuple in Python? Write an example.
Answer: What is a tuple in Python? Write an example.
4. Demonstrate how to delete an element from a dictionary using the del keyword
Answer: Demonstrate how to delete an element from a dictionary using the del keyword

5. What happens if you try to access a dictionary key that does not exist?
Answer: What happens if you try to access a dictionary key that does not exist?
6. Is tuple immutable?Explain
Answer: Is tuple immutable?Explain
7. State two differences between tuples and lists.
Answer: State two differences between tuples and lists.
8. Write Python code to create a tuple with values (10, 20, 30) and access the second
element.

[Link] 18/21
15/10/2025, 19:02 Model Question Paper (Preview)

Answer: Write Python code to create a tuple with values (10, 20, 30) and access the second
element.
9. Differentiate between dictionary methods get() and direct key access (dict[key]).
Answer: Differentiate between dictionary methods get() and direct key access (dict[key]).
10. Write the syntax to create an empty dictionary.
Answer: Write the syntax to create an empty dictionary.
Unit 5
1. What is the use of raise statement?
Answer: What is the use of raise statement?
2. Name the directory methods for creating and removing directories.
Answer: Name the directory methods for creating and removing directories.
3. Explain the difference between read() and readline() methods.
Answer: Explain the difference between read() and readline() methods.

4. List any four file opening modes in Python.


Answer: List any four file opening modes in Python.
5. Explain the use of the getcwd() method in directory handling.
Answer: Explain the use of the getcwd() method in directory handling.

6. Write Python code to open a file named "[Link]" in write mode.


Answer: Write Python code to open a file named "[Link]" in write mode.
7. Justify the need for exception handling in Python programs.
Answer: Justify the need for exception handling in Python programs.
8. Give the syntax of the file renaming.
Answer: Give the syntax of the file renaming.
9. Give two examples of built-in exceptions in Python.
Answer: Give two examples of built-in exceptions in Python.
10. What is the purpose of the try…finally block in exception handling?
Answer: What is the purpose of the try…finally block in exception handling?
Part C — 10 mark(s) each
Unit 1
1. Explain the key features of Python that make it popular among programmers. Give suitable
examples where applicable.
Answer: Explain the key features of Python that make it popular among programmers. Give
suitable examples where applicable.
2. Explain different ways of running a python program in various environment.
Answer: Explain different ways of running a python program in various environment.
3. Analyze how interpreter mode and interactive mode differ in Python execution. Discuss
scenarios where each mode is more suitable.

[Link] 19/21
15/10/2025, 19:02 Model Question Paper (Preview)

Answer: Analyze how interpreter mode and interactive mode differ in Python execution.
Discuss scenarios where each mode is more suitable.
4. Explain different Python data types with suitable examples of declaration and usage.
Answer: Explain different Python data types with suitable examples of declaration and usage.
Unit 2
1. Explain the types of if statements in Python (if, if…else, if…elif) with syntax and
examples.
Answer: Explain the types of if statements in Python (if, if…else, if…elif) with syntax and
examples.
2. Explain the syntax and structure of user defined function with example
Answer: Explain the syntax and structure of user defined function with example
3. Discuss the working of loop control statements break, continue, and pass. Provide examples
to demonstrate how they alter loop execution.
Answer: Discuss the working of loop control statements break, continue, and pass. Provide
examples to demonstrate how they alter loop execution.
4. Compare for and while loops in Python with respect to syntax, execution flow, and suitable
use cases. Provide code examples.
Answer: Compare for and while loops in Python with respect to syntax, execution flow, and
suitable use cases. Provide code examples.
Unit 3
1. Demonstrate the use of escape characters in Python strings with at least five examples.
Answer: Demonstrate the use of escape characters in Python strings with at least five
examples.
2. Define strings in Python. Explain any five string methods with examples.
Answer: Define strings in Python. Explain any five string methods with examples.
3. Discuss the concept of string slicing in Python. Illustrate how positive and negative indices
can be used with examples.
Answer: Discuss the concept of string slicing in Python. Illustrate how positive and negative
indices can be used with examples.
4. Explain any four list handling methods with examples.
Answer: Explain any four list handling methods with examples.
Unit 4
1. Give the basic tuple operations with example.
Answer: Give the basic tuple operations with example.
2. Define tuple in Python. Explain how to create and access tuple elements with suitable
examples.
Answer: Define tuple in Python. Explain how to create and access tuple elements with suitable
examples.
3. Explain any seven built in dictionary methods with example.

[Link] 20/21
15/10/2025, 19:02 Model Question Paper (Preview)

Answer: Explain any seven built in dictionary methods with example.


4. Write a Python program to demonstrates different operations on tuple.
Answer: Write a Python program to demonstrates different operations on tuple.
Unit 5
1. Write a python program to copy file contents from one file to another and display number
of words copied.
Answer: Write a python program to copy file contents from one file to another and display
number of words copied.

2. Explain directory methods mkdir(), chdir(), getcwd(), and rmdir() with syntax and suitable
examples.
Answer: Explain directory methods mkdir(), chdir(), getcwd(), and rmdir() with syntax and
suitable examples.
3. Discuss how exceptions are handled in python with suitable example.
Answer: Discuss how exceptions are handled in python with suitable example.
4. Explain about reading a file and writing a file with examples.
Answer: Explain about reading a file and writing a file with examples.

[Link] 21/21

Common questions

Powered by AI

In Python, mutable data types like lists and dictionaries allow for changes in their elements after creation, whereas immutable types like strings and tuples do not permit element modifications once they are created .

The 'in' operator in Python is used to check membership of an element within a list, returning 'True' if the element exists. This operator is essential for concise, readable code that performs membership tests efficiently .

The structure and syntax of 'if', 'if...else', and 'if...elif' statements in Python allow developers to implement complex conditional logic efficiently. The 'if' statement checks a condition; 'if...else' provides an alternative code path, and 'if...elif' supports multiple conditions, enhancing readability and control in logic flow .

The 'is' operator is more efficient than '==' for checking object identity because it checks if two variables point to the same object in memory, whereas '==' checks for value equality .

The 'title()' method in Python capitalizes the first letter of each word in a string, while 'upper()' converts all characters in the string to uppercase, making 'title()' suitable for formatting titles and 'upper()' for converting text entirely to uppercase .

Immutability is essential for dictionary keys in Python because it allows the keys to be hashable, which is necessary for the dictionary to efficiently retrieve values .

Python is considered a portable programming language because it can run on different operating systems without modification .

The 'append()' method adds a single element to the end of a list, while 'extend()' adds multiple elements from another iterable. 'Extend()' is more efficient for adding multiple items at once, reducing the number of operations required compared to consecutive 'append()' calls .

String methods like 'replace()' allow for the efficient modification of strings by replacing specified characters or sequences. For example, 'hello'.replace('l', 'x') returns 'hexxo', showing how 'l' is replaced with 'x' .

The 'continue' statement in Python loops is crucial because it allows the loop to skip the rest of the code inside the current iteration and immediately jump to the next iteration, providing more control over the execution flow and helping to avoid nested conditions .

You might also like