TOPICS: Very able Variables, If you think for a while
1. String data type is used in Python to store a sequence of characters.
2. The int data type is used to store whole numbers (integers).
3. In Python, repeating a block of code until a condition becomes false is known as looping (while loop).
4. Correct answer: b. marks_2
(Variable names cannot start with a number, cannot contain spaces, and cannot have special characters like -).
5. The if-elif-else statement can be used when there are multiple possible conditions to check.
6.
a. Logical operator and is used.
b. The user must enter both the correct username and the correct password – both conditions need to be true at the same time.
7.
number = int(input("Enter a number: "))
if number > 0:
print("Positive number")
elif number < 0:
print("Negative number")
else:
print("Zero")
8.
The while loop allows us to repeat a block of code as long as a condition remains true.
Syntax:
while condition:
statements
9.
a. Converting a number to string:
str(number)
b. Taking input from the user:
input("Enter value: ")
10.
a. != → Not equal to operator. Checks if two values are different.
Example: 5 != 3 → True
b. > → Greater than operator. Checks if the left value is greater than the right.
Example: 7 > 2 → True
