Saturday, 3 July 2021

Python if / else

 Python if / else

a1=int(input("Enter the number:\n"))
a2=int(input("Enter the number:\n"))
a3=int(input("Enter the number:\n"))
a4=int(input("Enter the number:\n"))
if((a1>a2)and(a1>a3)and(a1>a4)):
    print(a1,"is greater than ",a2,a3,a4)
elif((a2>a1)and(a2>a3)and(a2>a4)):
    print(a2," is greater than",a1,a3,a4)
elif((a3>a1)and(a3>a2)and(a3>a4)):
    print(a3," is greater than",a2,a1,a4)
else:
    print(a4," is greater than",a2,a3,a1)
    

a1=int(input("Enter the number:\n"))
a2=int(input("Enter the number:\n"))
a3=int(input("Enter the number:\n"))
a4=int(input("Enter the number:\n"))
if(a1>a4):
    f1=a1
else:
    f1=a4
if(a2>a3):
    f2=a2
else:
    f2=a3
if(f1>f2):
    print(f1,"is a greater")
else:
    print(f2,"is a greater")


comment=input("Enter the comment :\n")
Spam=False
if("make a lot of moneyin comment):
    Spam=True
elif("buy nowin comment):
    Spam=True
elif("subcribe thisin comment):
    Spam=True
elif("click thisin comment):
    Spam=True
else:
    Spam=False
if(Spam):
    print("text is a spam")
else:
    print("text is not a spam")



Username=input("Enter the user name :\n")
a=int(len(Username))
# print(a)
if(a<10):
    print("Yes")
else:
    print("NO")



l1=["ram","shaam","upendra","nitesh","maya"]

name=input("Enter the name U want:\n")
if(name in l1):
    print("yes")
else:
    print("No")

marks=int(input("Enter the marks obtained :\n"))
if(marks>=90 and marks<=100):
    pgrade='Ex'
elif(marks>=80 and marks<=90):
    grade='A'
elif(marks>=70 and marks<=80):
    grade='B'
elif(marks>=60 and marks<=70):
    grade='C'
elif(marks>=50 and marks<=60):
    grade="D"
else:
    grade="F"

print("Your grade is "+grade)



post=input("Enter the post:\n")
if("harryin post):
    print("yes")
elif("Harryin post):
    print("yes")
elif("HaRRyin post):
    print("yes")
elif("HArryin post):
    print("yes")
elif("HArrYin post):
    print("yes")
elif("HARRYin post):
    print("yes")
else:
    print("no")


age=int(input("Enter the age:\n"))
if(age>=18):
    print("yes")
else:
    print("no")



a=20
if(a>10):
    print(,"is greater than 10")
elif(a>5):
    print("a is greater than 20")
else:
    print("a is not greater than 20 nor equal to 20")




No comments:

Python if / else

 Python if / else a1 = int ( input (" Enter the number: \n ")) a2 = int ( input (" Enter the number: \n ")) a3 = int ( i...