with Complete Solutions6
1. What is the output of print(list[2:]) if list=[ 'abcd',786, 2.23]? - ANSWERS-[2.23]
2. What is the output of print (tinylist * 2) if tinylist = [123, 'john']? - ANSWERS-[123, 'john',123,
'john']
3. Which of the following is correct about tuples in Python? - ANSWERS-***
4. What is the output of print(myTuple) if myTuple = ('abcd',786,2.23)? - ANSWERS-
('abcd',786,2.23)
5. What is the output of print(myTuple[1:3]) if myTuple=('abcd',786,2.23)? - ANSWERS-(786,
2.23)
6. What is the output of print (myTuple[0]) if myTuple = ('abcd',786,2.23)? - ANSWERS-abcd
7. Which function obtains all the keys from a dictionary? - ANSWERS-keys()
8. Which function obtains all the values from a dictionary? - ANSWERS-values()
9. Which function converts a string to an int ? - ANSWERS-int("string")
10. Which function converts a string to a float ? - ANSWERS-float("string")
, 11. Which of the following data types are supported in Python? - ANSWERS-The following data
type are *Supported*:
1 - Numbers
2 - String
3 - List
4 - Tuples
5 - Dictionary
12. Which of the following data types are *not* supported in Python? - ANSWERS-Slice
13. What is the output of print(str) if str = 'Hello World!'? - ANSWERS-Hello World!
14. What is the output of print(str[0]) if str = 'Hello World!'? - ANSWERS-H
15. What is the output of print(str[2:5]) if str = 'Hello World!'? - ANSWERS-llo
16. What is the output of print(str[2:]) if str = 'Hello World!'? - ANSWERS-llo World!
17. What is the output of print(str * 2) if str = 'Hello World!'? - ANSWERS-Hello World!Hello
World!
18. What is the output of print(list) if list=[ 'abcd', 786 , 2.23]? - ANSWERS-['abcd', 786 , 2.23]
19. What is the output of print(list[0]) if list =[ 'abcd', 786 , 2.23]? - ANSWERS-abcd
20. What is the output of print(list[1:3]) if list=[ 'abcd', 786 , 2.23]? - ANSWERS-[786, 2.23]