MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following can be stored in a python list?
A
A string
B
A float
C
An integer
D
All of the options
Explanation: 

Detailed explanation-1: -A string is a sequence of one or more characters (letters, numbers, symbols) that can be either a constant or a variable. Made up of Unicode, strings are immutable sequences, meaning they are unchanging.

Detailed explanation-2: -To do this we use the split() method in string. The split method is used to split the strings and store them in the list. The built-in method returns a list of the words in the string, using the “delimiter” as the delimiter string.

Detailed explanation-3: -Answer. The valid strings in Python are “hello” and ‘hello’. A string in Python is a data type comprising a set of characters, numbers, and spaces.

There is 1 question to complete.