0% found this document useful (0 votes)
12 views

python questions

Uploaded by

Rayan ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

python questions

Uploaded by

Rayan ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a function that takes an integer between 1 and 7 and prints the
corresponding day of the week. The mapping is as follows:

 1: "Monday"

 2: "Tuesday"

 3: "Wednesday"

 4: "Thursday"

 5: "Friday"

 6: "Saturday"

 7: "Sunday"

If the input is not between 1 and 7, print "Invalid input".

2. Write a Python function that takes three integers representing the lengths
of the sides of a triangle and classifies the triangle as:

 "Equilateral" if all sides are equal

 "Isosceles" if exactly two sides are equal

 "Scalene" if all sides are different

If the input sides do not form a valid triangle, print "Invalid Triangle".

3. Write a Python function that checks if a given year is a leap year. The year
is a leap year if:

 It is divisible by 4, and

 It is not divisible by 100, unless

 It is also divisible by 400.

Print "Leap Year" if the year is a leap year, otherwise print "Not a Leap Year".
4. Write a Python function that takes an integer n and classifies the number
based on the following conditions:

 If n is divisible by both 3 and 5, print "Divisible by 3 and 5".

 If n is divisible by only 3, print "Divisible by 3".

 If n is divisible by only 5, print "Divisible by 5".

 Otherwise, print "Not Divisible by 3 or 5".

5. Write a function that takes a character and checks:

 If the character is a vowel (a, e, i, o, u), print "Vowel".

 If the character is a consonant, print "Consonant".

 If the character is uppercase, print "Uppercase" after the result.

 If the character is lowercase, print "Lowercase" after the result.

The character will always be an alphabetic character.

You might also like