Complete Solutions8
All keywords in Python are in
a. lower case
b. UPPER CASE
c. Capitalized
d. None of the above - ANSWERS-d. None of the above
______________(str) is the function to run in the shell to find out details about how to use str()
and the type of data it accepts and returns. - ANSWERS-help
Which of the following is an invalid statement?
a. abc = 1,000,000
b. a b c = 1000 2000 3000
c. a,b,c = 1, 2, 3
d. a_b_c = 4,000,000 - ANSWERS-b. a b c = 1000 2000 3000
Which one of the following have the highest precedence in the expression?
a. Exponential
b. Addition
c. Multiplication
, d. Parentheses - ANSWERS-d. Parentheses
Following set of commands are executed in shell, what will be the output?
>>> str = "hello"
>>> str[:2]
>>> - ANSWERS-he; because you are printing only the first two bytes of string.
The following is displayed after a print() call:
tom
dick
harry
Select the function call that results in this output
a. print("\ttom
\tdick
\tharry")
b. print("\ttom \tdick \tharry")
c. print(" tom dick harry")
d. print("\ttom\n\tdick\n\tharry") - ANSWERS-d. print("\ttom\n\tdick\n\tharry")
What is the output of the following code:
x = ['ab', 'cd']
for i in x:
-> i. upper()
print(x) - ANSWERS-['ab', 'cd']