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