[go: up one dir, main page]

0% found this document useful (0 votes)
6 views2 pages

Untitled 114

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Untitled 114

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

num = float(input("Enter a number: "))

if num > 0:
print("The number is positive.")
elif num < 0:
print("The number is negative.")
else:
print("The number is zero.")

Enter a number: 76834


The number is positive.

num = int(input("Enter a number: "))


if num % 2 == 0:
print("The number is even.")
else:
print("The number is odd.")

Enter a number: 22
The number is even.

year = int(input("Enter a year: "))


if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
print("It is a leap year.")
else:
print("It is not a leap year.")

Enter a year: 2300


It is not a leap year.

a = float(input("Enter first number: "))


b = float(input("Enter second number: "))
if a > b:
print("The first number is larger.")
elif b > a:
print("The second number is larger.")
else:
print("Both numbers are equal.")

Enter first number: 23


Enter second number: 46
The second number is larger.

char = input("Enter a single alphabet: ").lower()


if char in ['a', 'e', 'i', 'o', 'u']:
print("It is a vowel.")
elif char.isalpha():
print("It is a consonant.")
else:
print("Invalid input. Please enter a letter.")
Enter a single alphabet: a
It is a vowel.

num = int(input("Enter a number: "))


if num % 5 == 0 and num % 11 == 0:
print("The number is divisible by both 5 and 11.")
else:
print("The number is not divisible by both 5 and 11.")

Enter a number: 3333


The number is not divisible by both 5 and 11.

char = input("Enter a single character: ")


if char.isupper():
print("The character is uppercase.")
elif char.islower():
print("The character is lowercase.")
else:
print("It is not an alphabet letter.")

Enter a single character: e


The character is lowercase.

You might also like