100-Days OF Python-Day-03

 Hello Guys Welcome to Day-03.

By the end of today you will be learning the below topics:

1.       Conditional Statements

2.       Logical operations

3.       Global & Local variable name scoping

4.       Code Blocks

 

 

Conditional Statements

First we will be dealing with Conditional statements that if a 

particular conditions occurs do this or else do that.

Syntax for if

 

If condition:

              Do

Else:

              Do this

 

WAP for Roller Coster Eligibility:

 print("Welcome To The rollerCoster Ride!")

Height=int(input("What is your height?"))
if Height > 120:
    print("You are eligible")
else:
    print("Sorry you are not allowed")

 

Comparison Operator:

Greater than:>

Less Than:<

Greater Than or Equal:>=

Less Than or Equal:<=

Equal To:==

Not Equal:!=

 WAP To check a number Odd or Even:

number=int(input("Which number do you want to Check? "))
if number%2==0:
    print("This is an odd number.")
else:
    print("This is an even number. ")

WAP For Age segment ticket counter:
  Height=int(input("What is your height?"))
if Height > 120:
    print("You are eligible")
    age=int(input("Please enter your age:"))
    if age < 12:
        print("Your ticket amount is 5$ ")
    elif  18>age>12:
        print("Your ticket is 12$  ")
    else:
        print("Your Ticket is 20$  ")
else:
    print("Sorry you are not allowed")

WAP to calculate the leap year:
leap_year=int(input("Which year do you want to check?"))
if leap_year % 4 ==0:
    if leap_year%100 ==0:
        if leap_year%400==0:
            print("Leap year.")
        else:
            print("Not leap year.")
    else:
        print("Leap year.")
else:
    print("Not leap year.")

WAP For Pizza Automated Delivery App:
print("Welcome to Python Pizza Deliveries!")
size = input("What size pizza do you want? S, M, or L ")
add_pepperoni = input("Do you want pepperoni? Y or N ")
extra_cheese = input("Do you want extra cheese? Y or N ")
Bill=0
if size=="S":
    Bill=Bill+15
elif size=="M":
    Bill=Bill+20
elif size=="L":
    Bill=Bill+25
if add_pepperoni=="Y":
    if size=="S":

        Bill=Bill+2
    else:
        Bill=Bill+3
if extra_cheese=="Y":
    Bill=Bill+1

WAP For Love Calculator
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
lower_name1=name1.lower()
lower_name2=name2.lower()
word=lower_name1+lower_name2
print(word)
T=word.count("t")
R=word.count("r")
U=word.count("u")
E=word.count("e")
l=word.count("l")
o=word.count("o")
v=word.count("v")
e=word.count("e")
T_sum=T+R+U+E
L_sum=l+o+v+e
print(T_sum)
print(L_sum)
love_calc1=str(T_sum)+str(L_sum)
love_calc=int(love_calc1)
if love_calc<10 and love_calc>90:
    print("Your score is **x**,you go together like coke and mentos")
elif love_calc<50 and love_calc>40:
    print('Your score is **y**, you are alright together.')
else:
    print("Your score is **z**.")


Comments

Popular posts from this blog

Top 5 Best Books For Python,Data Science & Machine Learning

How To Start A BLOG

Top 50 Most Innovative Companies in 2020

Why Should We learn C Programming?

Blogger Tutorial