- Check if a number is Positive, Negative, or Zero nums=map(float,input("enter a numbers :").split(" ")) for num in nums: if num>0: print(f"{num} is positive number") elif num<0: print(f"{num} is negative number") else: print(f"{num} is a zero")
2.Write a Python program that takes a positive integer as input and calculates its factorial using a for loop. Display the factorial as the output.
n=int(input("enter a number:"))
fact=1
for i in range(1,n+1):
fact=fact*i
print(fact)

- Write a Python program that takes two numbers (which may be integers or decimals) as input from the user and calculates their sum. Display the result. num1=float(input("enter num1:")) num2=float(input("enter num2:")) total= num1+num2 print(total)
4.Write a Python program that asks the user to enter a word or number and checks whether it is a palindrome.
user_input=map(input("Enter a word:").split(" "))
for input in user_input:
if user_input==user_input[::-1]:
print("plaindrome")
else:
print("nota plaindrome")

- Check if a given year is a leap year. years=map(int,input("Enter a year:").split()) for year in years: if (year % 4 ==0 and year % 100!=0) or (year % 400==0): print(f"{year} is a leap year") else: print(f"{year} is not a leap year")