Python Lab

AI Lab 2: Python Questions

A total of 15 questions to test your Python fundamentals.

  1. Write a python program to display a particular month of a year using the `calendar` module.
  2. Write a python program to print all the months of a given year.
  3. Write a python program to print whether a number is positive, negative, or zero using if-elif-else.
  4. Write a python program to find the largest number among three numbers.
  5. Write a python program to read a number (1-7) and display the corresponding day of the week.
  6. Write a python program to check whether a given string is a palindrome or not.
  7. Write a python program to find the factorial of a given number using a function.
  8. Write a Python function that takes two lists and returns `True` if they are equal, otherwise `False`.
  9. Write a Python function to check if a given number is a prime number.
  10. Write a Python program to count the number of vowels in a given string.
  11. Create a Python script that takes a list of numbers and returns a new list containing only the even numbers.
  12. Write a function that accepts an arbitrary number of arguments and returns their sum.
  13. Write a program that swaps the values of two variables without using a temporary variable.
  14. Write a program to merge two dictionaries.
  15. Write a Python program to handle a `ValueError` when converting a non-integer string to an integer.