Exercise 1: Check Negative Number
Write a program that takes an integer input from the user and checks if the number is negative. If the number is negative, print "The number is negative".
Exercise 2: Voting Eligibility
Write a program that asks the user to enter their age. If the age is greater than or equal to 18, print "You are eligible to vote".
Exercise 3: Temperature Check
Write a program that asks the user to enter a temperature in Fahrenheit. If the temperature is below 32, print "It's freezing". Otherwise, print "It's not freezing".
Exercise 4: Divisibility by 5
Write a program that takes a number as input from the user and checks if the number is divisible by 5. If it is, print "The number is divisible by 5". If it is not, print "The number is not divisible by 5".
Exercise 5: Number Classification
Write a program that takes an integer input from the user and prints "Positive", "Negative", or "Zero" based on whether the number is positive, negative, or zero.
Exercise 6: Day Type Identifier
Write a program that takes a day of the week as input (e.g., "Monday", "Tuesday") and prints whether it is a weekday or weekend using the match-case statement.
Exercise 7: Month Name Finder
Write a program that takes an integer input from the user and uses a match-case statement to print the corresponding month name (1 for January, 2 for February, etc.). Print "Invalid month" if the input is not between 1 and 12.
Exercise 8: Character Type Identifier
Write a program that takes an input from the user and checks if it is an uppercase letter, a lowercase letter, a digit, or a special character. Use an if-elif-else statement to print the appropriate category.
Exercise 9: Day Type Identifier
Write a program that takes a day of the week as input (e.g., "Monday", "Tuesday") and prints whether it is a weekday or weekend using the match-case statement.
Exercise 10: Month Name Finder
Write a program that takes an integer input from the user and uses a match-case statement to print the corresponding month name (1 for January, 2 for February, etc.). Print "Invalid month" if the input is not between 1 and 12.
Exercise 11: Discount Calculator
Write a program that takes the total purchase amount as input and applies a discount based on the following criteria:
- If the amount is greater than $100, apply a 10% discount.
- If the amount is between $50 and $100, apply a 5% discount.
- If the amount is less than $50, no discount.
Use an if-elif-else statement to calculate and print the final amount after discount.
Exercise 12: BMI Calculator
Write a program that calculates the Body Mass Index (BMI) based on user input for weight (in kilograms) and height (in meters). Use if-elif-else statements to categorize the BMI into:
- Underweight (BMI < 18.5)
- Normal weight (18.5 <= BMI < 25)
- Overweight (25 <= BMI < 30)
- Obesity (BMI >= 30)
Exercise 13: Traffic Light Simulator
Write a program that takes a traffic light color (red, yellow, green) as input from the user and prints the corresponding action using a match-case statement. For example, "red" should print "Stop", "yellow" should print "Caution", and "green" should print "Go".
Exercise 14: Season Identifier
Write a program that takes a month number (1-12) as input and prints the corresponding season using a match-case statement. Assume:
- December, January, February: Winter
- March, April, May: Spring
- June, July, August: Summer
- September, October, November: Autumn