Question 1
Which function is used to format a string in python?
Question 2
What is the default separator between multiple items printed using the print( ) function?
Question 3
What is the purpose of the sep parameter in the print( ) function?
Question 4
What is the output of the following code?
data = "1 2 3 4"
numbers = data.split()
sum = 0
for num in numbers:
sum +=int(num)
print(sum)
Question 5
Which placeholder is used to format an integer in a string using the format( ) method?
Question 6
What happens when the input( ) function encounters an end-of-file (EOF) while reading?
Question 7
The input() function returns data in which data type?
Question 8
To redirect the output of the print( ) function to a file, which symbol is used?
Question 9
What is the output of the following code?
name = "john"
age = 30
print("my name is {} and I am {} years old.".format(name))
Question 10
What does the 'encoding' parameter specify when opening a file in python?
Question 11
To print output to the console in python, which function is used?
Question 12
Which function is used to remove trailing whitespaces from a string in python?