Python Program to check character is Alphabet or not
#python program to check whether a character is alphabet or not.
ch= input("enter a character")
if((ch >= 'a' and ch<='z') or (ch>='A' and ch<='Z')):
print("given character is an alphabet")
else:
print("given character isn't an alphabet)
Python Program to is positive or not.
#python program to check whether a number is positive or not.
n = float(input("Enter a number: "))
if n > 0:
print("Positive number")
else:
print("Negative number")
Python Program to print and add numbers starting 1 onwards till the sum of them is less than 100
#python program to print and add number starting from 1 and the sum is less than 100
m=100
i=1
s=1
while(s<m):
print("the sum till num {} is {}".format(i,s))
i=i+1
s=s+i
No comments:
Post a Comment