Which of the following symbols is used to define a tuple in Python?
- ( )
- < >
- [ ]
- { }
In Python, tuples are defined using parentheses ( ). For example, my_tuple = (1, 2, 3) creates a tuple named my_tuple.
Loading...
Related Quiz
- How can you call a method of the parent class from within a method of a child class?
- How is a generator function different from a normal function in Python?
- You are assigned to implement a complex object creation scenario where the object’s construction process should be separate from its representation. Which design pattern would you use?
- You are asked to design an algorithm to reverse the words in a string ('hello world' becomes 'world hello'). Which approach would allow you to do this in-place, without using additional memory?
- In a for-loop iterating through a list, if a specific condition is met and you want to skip the remaining code in the current iteration but not exit the loop, you would use the _______ statement.