Write the code using the Basic If condition in Python:
if a > b:
print("a is greater than b")
if temperature > 30:
print("It's a hot day")
if len(name) > 5:
print("Name is longer than 5 characters")
if score >= 50:
print("You passed")
else:
print("You failed")
if is_raining:
print("Take an umbrella")
else:
print("You don't need an umbrella")
if grade >= 90:
print("Grade: A")
elif grade >= 80:
print("Grade: B")
elif grade >= 70:
print("Grade: C")
elif grade >= 60:
print("Grade: D")
else:
print("Grade: F")
if age < 13:
print("Child")
elif age < 20:
print("Teenager")
elif age < 65:
print("Adult")
else:
print("Senior")
if response == 'y':
print("Yes")
elif response == 'n':
print("No")
else:
print("Invalid input")
if season == 'Spring':
print("Plant the garden!")
elif season == 'Summer':
print("Water the garden!")
elif season == 'Fall':
print("Harvest the garden!")
elif season == 'Winter':
print("Read a book!")
if score < 50:
print("Fail")
elif score < 60:
print("D Grade")
elif score < 70:
print("C Grade")
elif score < 80:
print("B Grade")
else:
print("A Grade")
operation = input("Choose an operation (+, -, *, /): ")
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
if operation == '+':
print("Result:", a + b)
elif operation == '-':
print("Result:", a - b)
elif operation == '*':
print("Result:", a * b)
elif operation == '/':
if b != 0:
print("Result:", a / b)
else:
print("Error: Division by zero.")
else:
print("Invalid operation")
age = int(input("Enter your age: "))
if age < 13:
print("You are a child.")
elif age >= 13 and age < 18:
print("You are a teenager.")
elif age >= 18 and age < 60:
print("You are an adult.")
elif age >= 60:
print("You are a senior.")
else:
print("Invalid age.")
if a > b:
if c > d:
print("Both conditions are true")
if year >= 2000:
if year <= 2020:
print("Year is in the 21st century")
if score > 50:
if score >= 90:
print("Grade A")
else:
print("Grade B")
else:
print("Failed")
if temperature > 0:
if temperature < 20:
print("Cold")
elif temperature < 30:
print("Warm")
else:
print("Hot")
else:
print("Freezing")
if x > 10:
if x < 20:
if y > 100 and y < 200:
print("x is between 10 and 20, and y is between 100 and 200")
print("Welcome to the world of Intelligence-Pycent.com") if a > b else None
x = 5 if a > 10 else 0
print("Yes") if True else print("No")
status = "Adult" if age >= 18 else "Minor"
color = "Red" if choice == 1 else "Blue" if choice == 2 else "Green"
result = function1() if a > b else function2()
x = 10 if a > b else 20 if a == b else 30
even_numbers = [i for i in range(10) if i % 2 == 0]
status = "High" if score > 90 else "Medium" if score > 50 else "Low"
print("Yes") if condition1 and condition2 else print("Maybe") if condition3 else print("No")