What is the result of the following operation in Python? ('apple',) * 3
- ('apple', 3)
- ('apple', 'apple', 'apple')
- ('apple',)
- Error
The result of ('apple',) * 3 is a tuple containing three copies of the string 'apple'. The comma in ('apple',) is necessary to create a single-element tuple.
Loading...
Related Quiz
- You are developing a Django application with a focus on high performance. How would you optimize database queries in views to reduce the load time?
- How can you invoke the method of a superclass from a subclass?
- In Python, which keyword is used to define a metaclass within a class definition?
- The ____ function in Pandas is used to pivot a DataFrame to create a reshaped, sorted DataFrame.
- Which Python module would you use for logging error and debugging messages?