Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Python Assessment Questions

Last Date to summit - 08/04/2024

Answer Any 15 Questions

1. Assign the value 5 to a variable called num and print its value.

2. Assign the string "Hello, World!" to a variable called message and


print it.

3. Assign the result of adding 10 and 20 to a variable called


sum_result and print its value.

4. Assign a list containing the elements [1, 2, 3, 4, 5] to a variable


called my_list and print it.

5. Assign the boolean value True to a variable called is_true and


print it.

6. Assign the value of the expression 2 * (3 + 4) to a variable called


result and print it.

7. Assign the value of the expression "Python" + " is fun" to a


variable called sentence and print it.

8. Assign the value of the expression 10 / 3 to a variable called


division_result and print it.

9. Assign the value of the expression 2 ** 3 to a variable called


exponential_result and print it.

10. Assign a dictionary with the keys "name" and "age" and their
respective values "John" and 25 to a variable called person_info
and print it.
11. . Assign the result of multiplying all numbers from 1 to 5
(inclusive) to a variable called `factorial` and print it.

12. . Assign a list comprehension that generates a list containing the


squares of numbers from 1 to 10 (inclusive) to a variable called
`squared_numbers` and print it.

13. . Assign a boolean value that represents whether the string


"racecar" is a palindrome to a variable called `is_palindrome` and
print it.

14. . Assign the value of the expression "Python" not in ["Java", "C++",
"Python"] to a variable called `language_not_found` and print it.

15. Assign a list containing the lengths of strings in the list ["apple",
"banana", "orange", "kiwi"] to a variable called `string_lengths` and
print it.

16. Assign the result of converting the string "123" to an integer to a


variable called `num` and print it.
17. Assign the value of the expression "hello".upper() to a variable
called `uppercase_word` and print it.

18. . Assign the value of the expression "python".capitalize() to a


variable called `capitalized_word` and print it.

19. Assign a list containing unique elements from the list [1, 2, 2, 3, 4,
4, 5] to a variable called `unique_elements` and print it.

20. Assign a dictionary comprehension that generates a dictionary


containing numbers from 1 to 5 (inclusive) as keys and their
squares as values to a variable called `squares_dict` and print it.

You might also like