Skip to content

22kq1a0552/CSP-using-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

  1. 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")
image

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) image

  1. 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)
image

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") image

  1. 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")
image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published