QUESTION IMAGE
Question
- what does the .split() method do? it changes a long string into a list, with each word separated by a space making up a single list item. it breaks up a list into two or more lists. the arguments you pass into it determine where the split occurs and what the names of the lists will be. splits up a function in two parts so that the computer can evaluate it quicker. 11. which of the following statements create a dictionary? select all correct responses. d = {45:\john\, 48:\peter\} d = {\john\:45, \peter\:48} d = {} d = (45:\john\, 48:\peter\) 12. will the following code return true or false? anchovies in pizza should never have anchovies. true false 13. suppose d1 = {\peter\:50, \john\:60} and d2 = {\peter\:301, \john\:60}, d1 > d2 will return ____ an error message true false
Brief Explanations
- In programming (specifically in languages like Python), the
.split()method on a string splits the string into a list where each word (separated by a space by default) becomes an item in the list. - In Python, a dictionary is created using curly - braces
{}with key - value pairs separated by colons:. The first three options are valid ways to create dictionaries. The fourth option with parentheses is incorrect as parentheses are used for tuples, not dictionaries. - The
inkeyword in Python is used to check if a substring is present in a string. Here, the word 'anchovies' is present in the given sentence. - Dictionaries in Python do not support direct comparison using the
>operator. This will result in an error message.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
- It changes a long string into a list, with each word separated by a space making up a single list item.
- d = {45:"john", 48:"peter"}, d = {"john":45, "peter":48}, d = {}
- True
- An error message