Variables
Data Types
Arithmetic Operations
Comparison Operations
Input and Output
100

What is the purpose of a variable in Python?

To store data that can be used and manipulated in a program.

100

What are the four main data types in Python?

int, float, string, boolean

100

What is the result of 5 + 3?

8

100

What does the == operator do?

It checks if two values are equal.

100

How do you read input from the user in Python?

input()

200

How do you assign a value to a variable named "x" ?

x = value

200

What data type is the value True?

boolean

200

What does the % operator do in Python?

It returns the remainder of a division (modulus).

200

What is the result of 5 < 3?

False

200

What function is used to display output in Python?

print()

300

What will be the output of the following code?

x = 10
y = x + 5
print

15

300

What is the difference between 10 and 10.0 in Python?

10 is an integer (int) and 10.0 is a float.

300

Evaluate 10 / 3. What type is the result?

3.3333333333333335 (float)

300

What does != mean in Python?

Not equal

300

Write a code snippet to read a user's name and print a greeting.

name = input("Enter your name: ")

print(f"Hello, {name}!")


400

How can you swap the values of two variables a and b in Python?

a, b = b, a

400

How do you find the data type of a variable x?

type(x)

400

What is the result of 2 ** 3?

8

400

Evaluate the following expression: 7 >= 7

True

400

How do you read an integer input from the user?

int(input())

500

Is it possible to change the type of a variable after it has been assigned a value? Give an example.

Yes, Python is dynamically typed

x = 10  # int

x = "Hello"  # now a string


500

Convert the string "123" to an integer.

int("123")

500

Simplify the following expression: 2 + 3 * 4

14

500

What is the result of not (4 > 5)?

True

500

What will be the output of the following code?

x = input("Enter a number: ")

print("You entered:", x)

 

It will print "You entered:" followed by the user's input as a string.

M
e
n
u