NEW
Font size
WorksheetsPython Basics
Total questions: 12
Worksheet time: 6mins
What is the correct extension of the Python file?
.py
.python
None of these
.p
How to insert COMMENTS in Python code?
"this is a comment"
#this is a comment
None of these
What do we use to define a block of code in Python language?
None of these
Key
Brackets
Indentation
What is a correct syntax to output “REC" in Python?
echo("REC")
print("REC")
echo “REC”
print ”REC”
What is the purpose of the input() function in Python?
To take input from the user
To convert an object into a string
To print a message on the screen
To add a string at the end of the output
What is the purpose of the print() function in Python?
To print a specified message on the screen
To take input from the user
To add a string at the end of the output
To convert an object into a string
What is the purpose of the int() function in Python?
To return an integer number
To return a complex number
To return a Boolean value
To return a decimal/floating point number
What is the purpose of the str() function in Python?
To return a decimal/floating point number
To return a Boolean value
To return a complex number
To return a string
What is the purpose of the bool() function in Python?
To return a Boolean value
To return a complex number
To return an integer number
To return a decimal/floating point number
What is the purpose of the complex() function in Python?
To return a Boolean value
To return a decimal/floating point number
To return a complex number
To return an integer number
What is the purpose of the % operator in Python?
To multiply elements of values
To replace instances of % in a string with elements of values
To add elements of values
To divide elements of values
What is the purpose of the string format method in Python?
To add elements of values
To replace instances of % in a string with elements of values
To divide elements of values
To multiply elements of values
