#----------------------------- 1- guess uisng if else ------------------------------
web= ['w','e','b','g','a','p','p']
num =[1,2,3,4,5,6,7,8,9,0]
guess = input("Guess a letter :")
if guess in web:
print("You are eligible to Join")
elif guess in str(num):
print("Please enter only letters.")
else:
print("You missed it !!..")
#----------------------------- 2- find greater using if else -------------------------
x = int(input("ENter the 1st number :" ))
y = int(input("ENter the 2nd number :" ))
if (x<y):
print(x," is greater than",y)
else :
print(y," is greater than ",x)
#----------------------------- 3- find equality using if else ------------------------
a = int(input("Enter 1st number :"))
b = int(input("Enter 2nd number :"))
c = int(input("Enter 3rd number :"))
if(a == b ) or (b== c):
print(b, " is common to ",a,c)
elif(a == b ) or (a == c):
print(a, " is common to ",c,b)
elif (c == a or c == b):
print(c," is common to ",a,b)
else:
print("All are unique")
#----------------------------- 4- odd or even using if else ------------------------
ranges= int(input("Enter the starting range "))
ending = int(input("Enter the ending range "))
for num in range(ranges, ending + 1):
if num % 2 == 0:
print(num," is even.")
else:
print(num," is odd.")
#----------------------------- 5- Guessing using if else ------------------------
import random
# Generate a random number between 1 and 100
key = random.randint(1, 100)
# Initialize variables
apply = 0
max = 10
# Start a loop for the guessing game
while apply < max:
guess = int(input("Guess the secret key (between 1 and 100): "))
# Check if the guess is correct
if guess == key:
print("Congratulations! You guessed the secret key:", key)
break # Exit the loop if the guess is correct
else:
apply += 1
if guess < key:
print(" Number is low.")
else:
print("Number is high.")
# Check if the player used all apply without guessing correctly
if apply == max:
print("Sorry, you've used all your attempts. The secret number was:", key)