Phase 1 - Level 4: Logical Operators & Compound Statements
Master logical operators and compound conditional statements.
10 programs · open one, then the next
Start with Check Letter, Digit, or Neither- 01Check Letter, Digit, or NeitherIntermediateTake a character and check if it is a letter, a digit, or neither.Open example →py# Take character ch = input("Enter a character: ") # Check type
- 02FizzBuzz ProblemIntermediateTake a number and print "Fizz" if divisible by 3, "Buzz" if divisible by 5, and "FizzBuzz" if divisible by both.Open example →py# Take number num = int(input("Enter a number: ")) # FizzBuzz logic
- 03Find Median ValueIntermediateTake three numbers and print the median value (neither maximum nor minimum).Open example →py# Take three numbers a = float(input("Enter first number: ")) b = float(input("Enter second number: ")) c = float(input("Enter third number: "))
- 04AM or PM CheckIntermediateTake 24-hour time (hours and minutes) and print whether it is AM or PM.Open example →py# Take time hours = int(input("Enter hours (0-23): ")) minutes = int(input("Enter minutes (0-59): "))
- 05Tax Eligibility CheckIntermediateTake income and age, and check if eligible for tax (age > 18 and income > 5 L).Open example →py# Take income and age income = float(input("Enter income (in lakhs): ")) age = int(input("Enter age: "))
- 06Positive Numbers Sum CheckIntermediateTake two numbers and check if both are positive and their sum is less than 100.Open example →py# Take two numbers num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: "))
- 07Print Digit WordIntermediateTake a single digit (0-9) and print its word form ("Zero" to "Nine").Open example →py# Take digit digit = int(input("Enter a digit (0-9): ")) # Map to word
- 08Weekday or WeekendIntermediateTake a weekday number (1-7) and determine if it is a weekday or weekend.Open example →py# Take day number day = int(input("Enter day number (1-7): ")) # Check weekday or weekend
- 09Electricity Bill CalculationIntermediateTake electricity units consumed and calculate the bill as per slabs (using if-else).Open example →py# Take units units = float(input("Enter units consumed: ")) # Calculate bill based on slabs
- 10Basic Password ValidationIntermediateTake a password string and check basic rules (length >= 8 and contains at least one digit).Open example →py# Take password password = input("Enter password: ") # Check rules