Podcast
Questions and Answers
What keyword is used to create a global variable inside a function in Python?
What keyword is used to create a global variable inside a function in Python?
- global (correct)
- scope
- local
- var
If you want to assign names of three different fruits to variables x, y, and z in one line, what syntax would you use?
If you want to assign names of three different fruits to variables x, y, and z in one line, what syntax would you use?
- x, y, z = ['Apple', 'Banana', 'Cherry']
- x, y, z = 'Apple', 'Banana', 'Cherry' (correct)
- fruitnames = {'x': 'Apple', 'y': 'Banana', 'z': 'Cherry'}
- fruitnames(x, y, z) = ('Apple', 'Banana', 'Cherry')
In Python, what is the correct keyword to make a variable belong to the global scope?
In Python, what is the correct keyword to make a variable belong to the global scope?
- scope
- global (correct)
- globalize
- public
Which data type would the variable x be when the following code is executed: x = str(5) print(type(x)) x = 20.5 print(type(x)) ?
Which data type would the variable x be when the following code is executed: x = str(5) print(type(x)) x = 20.5 print(type(x)) ?
To display the sum of 5 + 10 using variables x and y in Python, what code would you write?
To display the sum of 5 + 10 using variables x and y in Python, what code would you write?
What is the correct way to assign the value of x + y
to a variable called z
in Python?
What is the correct way to assign the value of x + y
to a variable called z
in Python?
Which of the following is a valid Python variable name?
Which of the following is a valid Python variable name?
What will happen if you create a variable inside a function with the same name as a global variable?
What will happen if you create a variable inside a function with the same name as a global variable?
Which of the following is true about Python variable names?
Which of the following is true about Python variable names?
What is the purpose of using the 'print()' function in Python?
What is the purpose of using the 'print()' function in Python?
What type of variables are created outside of a function in Python?
What type of variables are created outside of a function in Python?
Which of the following cannot be a valid Python variable name?
Which of the following cannot be a valid Python variable name?
What type of operators are used with numeric values to perform common mathematical operations?
What type of operators are used with numeric values to perform common mathematical operations?
Which operator is used to assign values to variables in Python?
Which operator is used to assign values to variables in Python?
What is the main purpose of comparison operators in Python?
What is the main purpose of comparison operators in Python?
Which group of operators is used to combine conditional statements in Python?
Which group of operators is used to combine conditional statements in Python?
What do membership operators in Python verify?
What do membership operators in Python verify?
In Python, which operator has the highest precedence?
In Python, which operator has the highest precedence?