Python Variable Declarations MCQs
Which of the following declarations is incorrect in python language?
(A). lm = 7
(B). l, m=8, 9
(C). l m=3
(D). l_m=2
MCQ Answer: l m=3
Which of the following declarations is correct in python language?
(A). m = 7
(B). n = “t4tutorials”
(C). mn = 99
(D). all of these
MCQ Answer: all of these
Which of the following declarations is incorrect in python language?
(A). l = str(7)
(B). m = int(7)
(C). n = float(7)
(D). None of these
MCQ Answer: None of these
Which of the following declarations is correct in python codes?
(A). m = “t4tutorials”
(B). m = ‘t4tutorials’
(C). both a and b
(D). None of these
MCQ Answer: both a and b
Which of the following declarations is correct in python programming?
(A). g = “t4tutorials”
(B). G = “t4tutorials”
(C). a and b representing same variables
(D). a and b are different variables
MCQ Answer: a and b are different variables
Which of the following declarations is incorrect in python language?
(A). 4g = “t4tutorials”
(B). 4g = “4tutorials”
(C). 4_g = “t4tutorials”
(D). All of these
MCQ Answer: All of these
Example of a Python program
1 2 3 4 5 6 7 8 9 |
# Ask the user to input numbers FirstNumber = input('Enter first number: ') SecondNumber = input('Enter second number: ') # Summ two numbers
sum = float(FirstNumber) + float(SecondNumber) # Show the sum print('The sum of {0} and {1} is {2}'.format(FirstNumber, SecondNumber, sum)) |
List of Python Programs
- Arithmetical operations in Python
- Area of a triangle in Python
- Swap two numbers in Python
- Convert Kilometres to Miles in Python
- Random Numbers in Python
- Quadratic equation in Python
- Converting the temperature from Celsius to Fahrenheit in Python
- Write a Program in Python to check if a Number is Positive, Negative, or Zero
- Even Odd Number in Python
- Leap Year in Python
- Calendar program in Python
- Prime Number in Python
- Multiplication Table in Python
- Fibonacci Series in Python
- Armstrong number in Python
- Factorial of a Number in Python
- Sum of Natural Numbers in Python