Computer Science
Which of the following four code fragments will yield following output?
Eina
Mina
Dika
Select all of the function calls that result in this output
- print('''Eina
\nMina
\nDika''') - print('''EinaMinaDika''')
- print('Eina\nMina\nDika')
- print('Eina
Mina
Dika')
Answer
print('Eina\nMina\nDika')
Reason —
- print('''Eina
\nMina
\nDika''') — It is a multiline string and by adding \n extra line will be added. - print('''EinaMinaDika''') — There is no new line character.
- print('Eina\nMina\nDika') — It adds new line by \n new line character.
- print('Eina
Mina
Dika') — It creates an error because it is a multiline string with no triple quotes.
Related Questions
Which value type does input() return ?
- Boolean
- String
- Int
- Float
Which two operators can be used on numeric values in Python?
- @
- %
- +
- #
Which of the following is valid arithmetic operator in Python :
- //
- ?
- <
- and
For a given declaration in Python as s = "WELCOME", which of the following will be the correct output of print(s[1::2])?
- WEL
- COME
- WLOE
- ECM