MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How can you changenum = {‘one’:1, ‘two’:3}tonum = {‘one’:1, ‘two’:2}
A
num[2] = ‘two’
B
num[1] = ‘two’
C
num[’two’] = 2
D
num[’two’] = ‘2’
Explanation: 

Detailed explanation-1: -Using split() method : This function helps in getting a multiple inputs from user. It breaks the given input by the specified separator. If a separator is not provided then any white space is a separator. Generally, user use a split() method to split a Python string but one can use it in taking multiple input.

Detailed explanation-2: -Taking Multiple Input in Python Using the split() Method To give multiple input in Python, the split() function in Python helps to split the multiple input fed by the user into single individual values for each variable. The method takes two parameters as part of its syntax that is, the separator and the maxsplit.

There is 1 question to complete.