Assignment Question for Class 10
Assignment Question for Class 10
def month_to_days(month):
month = month.lower() # Convert the input to lowercase to handle case-insensitive input
days_in_month = {
"january": 31,
"february": 28, # Assuming a non-leap year
"march": 31,
"april": 30,
"may": 31,
"june": 30,
"july": 31,
"august": 31,
"september": 30,
"october": 31,
"november": 30,
"december": 31
}
2. Write a program to find sum of squares of first n natural numbers where n is provided by
user.
sm = 0
sm = sm + (i * i)
return sm
n = int(input(“Enter a number”))
print(squaresum(n)
3. A company decided to give bonus of 5% to an employee if his/her year of service
is more than 5 years. Write a Python program to ask the user for their salary and
year of service and print the net bonus amount.
if years_of_service > 5:
bonus = salary * 0.05 # 5% bonus
else:
bonus = 0 # No bonus for less than or equal to 5 years of service
if bonus > 0:
print("Congratulations! You have earned a bonus of: ",bonus)
else:
print("Sorry, you are not eligible for a bonus.")
4. Create a list of all students in your class and sort them in alphabetical order.
# Program to store city data with average temperature and pollution details