Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
a=10
print(a)
10
a
10
#Assignment 1
#Create a list containing squares of numbers from 1 to 10 (HINT: use List Comprehension).
a=[x*x for x in range(10)]
a
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
#Assignment 2
#Write a Function to check if year number is a leap year.
def leap_year(year):
if year%4==0 and year%100!=0 or year%400==0 :
print(year, "is leap year")
else:
print(year, " is not leap year")
year=int(input("Enter a year: "))
leap_year(year)
Enter a year: 3000
3000 is not leap year