


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



num = float(input("Enter a number: ")) if num > 0 : print("Positive") elif num < 0 : print("Negative") else : print("Zero")
num = int(input("Enter an integer: ")) if num % 2 == 0 : print("Even") else : print("Odd")
a = float(input("Enter first number: ")) b = float(input("Enter second number: ")) if a > b: print("Largest is:", a) elif b > a: print("Largest is:", b) else : print("Both numbers are equal")
age = int(input("Enter your age: ")) if age >= 18 : print("Eligible to vote") else : print("Not eligible to vote")
ch = input("Enter a character: ").lower() if ch in 'aeiou': print("Vowel") else : print("Consonant")
ch = input("Enter a character: ") if ch.isupper(): print("Uppercase Letter") elif ch.islower(): print("Lowercase Letter") elif ch.isdigit(): print("Digit") else : print("Special Symbol")
a = float(input("Enter first number: ")) b = float(input("Enter second number: ")) c = float(input("Enter third number: ")) if a >= b and a >= c: print("Largest:", a) elif b >= a and b >= c: print("Largest:", b) else : print("Largest:", c)
marks = float(input("Enter marks (0-100): ")) if marks >= 90 : print("Grade: A") elif marks >= 80 : print("Grade: B") elif marks >= 70 : print("Grade: C") elif marks >= 60 : print("Grade: D") else : print("Grade: F")
year = int(input("Enter year: ")) if (year % 4 == 0 and year % 100 != 0 ) or (year % 400 == 0 ): print("Leap Year") else : print("Not a Leap Year")
cp = float(input("Enter Cost Price: ")) sp = float(input("Enter Selling Price: ")) if sp > cp: print("Profit:", sp - cp) elif cp > sp: print("Loss:", cp - sp) else : print("No Profit No Loss")
num = int(input("Enter a number: ")) if num % 3 == 0 and num % 5 == 0 : print("Multiple of both 3 and 5") elif num % 3 == 0 : print("Multiple of 3") elif num % 5 == 0 : print("Multiple of 5") else : print("Not a multiple of 3 or 5")
month = int(input("Enter month number (1-12): ")) if month in [ 1 , 3 , 5 , 7 , 8 , 10 , 12 ]: print("31 days") elif month in [ 4 , 6 , 9 , 11 ]: print("30 days") elif month == 2 : print("28 or 29 days") else : print("Invalid month number")
a = float(input("Enter first number: ")) op = input("Enter operator (+, -, *, /): ") b = float(input("Enter second number: "))
if op == '+': print("Result:", a + b) elif op == '-': print("Result:", a - b) elif op == '*': print("Result:", a * b) elif op == '/': print("Result:", a / b) if b != 0 else print("Cannot divide by zero") else : print("Invalid Operator")
user = input("Enter username: ") passw = input("Enter password: ")
if user == "admin": if passw == "12345": print("Login Successful") else : print("Error: Incorrect Password") else : print("Error: Incorrect Username")
units = float(input("Enter units consumed: ")) if units <= 100 : bill = 0 print("No charge") elif units <= 200 : bill = (units - 100 ) * 5 print("Total Bill: ā¹", bill) else : bill = ( 100 * 5 ) + (units - 200 ) * 10 print("Total Bill: ā¹", bill)