Questions and Answers Already Passed
What is the first step to getting started with Python?
By learning the syntax
✔✔Install Python on your computer
Use a specific IDE
Write Python code without installing anything
Which of the following is a basic data type in Python?
Set
✔✔Integer
Binary tree
Pointer
What does the `print()` function do in Python?
Performs mathematical calculations
Stores data in a variable
✔✔Outputs text or data to the screen
1
,Inputs data from the user
Which of the following is a correct way to create a variable in Python?
`int x = 5`
`variable x = 5`
✔✔`x = 5`
`5 = x`
What will the following code output?
`print("Hello, World!")`
`Hello`
`World`
✔✔Hello, World!
SyntaxError
How do you create a comment in Python?
By using `/*`
By using `<!-- -->`
2
,✔✔By using `#`
By using `//`
What is the result of the expression `3 + 4 * 2` in Python?
10
✔✔11
14
7
Which of the following is used to import libraries or modules in Python?
`include`
`module`
✔✔`import`
`library`
What does the `input()` function do in Python?
✔✔Takes input from the user
Adds two numbers
3
, Converts a string into an integer
Prints output to the console
Which of these is a correct syntax for defining a function in Python?
`function my_function():`
`def function my_function:`
✔✔`def my_function():`
`def: my_function()`
How do you create a list in Python?
`my_list = (1, 2, 3)`
`my_list = {1, 2, 3}`
✔✔`my_list = [1, 2, 3]`
`my_list = 1, 2, 3`
Which of the following is NOT a logical operator in Python?
`and`
✔✔`notor`
4