# This program prints Hello, world! print('Hello, world!')
# This program adds two numbers num1 = 1.5 num2 = 6.3 # Add two numbers sum = num1 + num2 # Display the sum print('The sum of num1 and num2 is ',sum)
# Store input numbers num1 = input('Enter first number: ') num2 = input('Enter second number: ') # Add two numbers sum = float(num1) + float(num2) # Display the sum print('The sum of num1 and num2 is ',sum)
a = float(input('Enter first side: ')) b = float(input('Enter second side: ')) c = float(input('Enter third side: ')) s = (a + b + c) / 2 area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 print('The area of the triangle is ' ,area)
x = input('Enter value of x: ') y = input('Enter value of y: ') print('The value of x before swapping: ',x) print('The value of y before swapping: ',y) temp = x x = y y = temp print('The value of x after swapping: ',x) print('The value of y after swapping: ',y)
print("Enter the Principle Amount: ") p = int(input()) print("Enter Rate of Interest (%): ") r = float(input()) print("Enter Time Period: ") t = float(input()) si = (p*r*t)/100 print("Simple Interest Amount: ") print(si)
pi = 3.14 diameter = int(input("enter the diameter of the circle")) radius = diameter / 2 perimeter = 2 * pi * radius print("perimeter of circle is ", perimeter)
num = int(input("enter the number : ")) if(num%2==0): print("It is Even number") else: print("It is Odd number")
age = int(input("enter the age : ")) if(age>=18): print("You can vote") else: print("You can't vote")
pi = 3.14 radius = int(input("enter the radius of the circle")) area = pi * radius * radius print("area of circle is ", area)
kilometers = float(input("Enter value in kilometers: ")) conv_fac = 0.621371 miles = kilometers * conv_fac print("kilometers is equal to miles",miles))
b=float(input("Enter the base of triangle")) h=float(input("Enter the height of triangle")) Area=(1/2)*b*h print("The area of triangle is : ", Area)
a = float(input("Enter the dividend : ")) b = float(input("Enter the divisor : ")) Q = a // b R = a % b print("The quotient is : ", Q) print('The remainder is : ", R)
a=int(input('Enter the first integer:')) b=int(input('Enter the second integer:')) c=int(input('Enter the third integer:')) if a>b and a>c: print(a, 'is the largest integer') elif b>c: print(b, 'is the largest integer') else: print(c, 'is the largest integer')
a=float(input('Enter the first number:')) b=float(input('Enter the second number:')) if a%b==0: print('The first number is fully divisible by second number') else: print('The first number is not fully divisible by second number')
Regular Buyer = 10% discount
Item Name Units Country Tax (per unit)
Laptop (650 USD) 1 – 10 UK 10 USD
Laptop (700 USD) 11 – 30 UK 8 USD
Laptop (900 USD) 1 – 10 US 20 USD
Laptop (850 USD) 11 – 30 US 17 USD
print("1: UK") print("2: US") country = int(input("enter your choice : ")) if(country==1): units = int(input("enter units : ")) if(units<=10): price = ((units*650) + (units*10)) print("You have to pay : ",price) elif(units<=30): price = ((units*700) + (units*8)) print("You have to pay : ",price) else: print("you can't enter more than 30") elif(country==2): units = int(input("enter units : ")) if(units<=10): price = ((units*900) + (units*20)) print("You have to pay : ",price) elif(units<=30): price = ((units*850) + (units*17)) print("You have to pay : ",price) else: print("you can't enter more than 30") else: print("not a valid country") print("1: Regular Buyer") print("2: Not a Regular Buyer") choice = int(input("are you a regular buyer or not? : ")) if(choice==1): dis = price * 0.90 print("Price after discount = ",dis) else: print("No discount please pay= ",price)
Coupon Code: //Ask at the time of booking
- 545 – 20% discount
- 543 – 10% discount
Room Type: //Ask at the time of booking
- Executive Suite – 300 $ per Adult | 200 $ per Child
- Deluxe Suite – 200 $ per Adult | 100 $ per Child
- Standard Room – 100 $ per Adult | 50 $ per Child
Maximum: 2 Adults and 2 children in 1 room
print("1: Executive Suite") print("2: Delux Suite") print("3: Standard Room") choice = int(input("enter room type ")) if(choice==1): adults = int(input("enter no of adults ")) childrens = int(input("enter no of childrens ")) if(adults>2 or childrens>2): print("members exceeding") else: price = adults * 300 + childrens * 200 print("Please Pay : ",price) elif(choice==2): adults = int(input("enter no of adults ")) childrens = int(input("enter no of childrens ")) if(adults>2 or childrens>2): print("members exceeding") else: price = adults * 200 + childrens * 100 print("Please Pay : ",price) elif(choice==3): adults = int(input("enter no of adults ")) childrens = int(input("enter no of childrens ")) if(adults>2 or childrens>2): print("members exceeding") else: price = adults * 100 + childrens * 50 print("Please Pay : ",price) else: print("this room type is not available") print("Do you have a coupon?") print("1: Yes") print("2: No") c = int(input("enter your choice ")) if(c==1): coupon = int(input("enter the code")) if(coupon==545): discountedprice = price*0.80 print("Coupon Applied - please pay : ",discountedprice) elif(coupon==543): discountedprice = price*0.90 print("Coupon Applied - please pay : ",discountedprice) else: print("Invalid Coupon") else: print("No Discount Please Pay : ",price)
Currency Convert To Rate Agent / Bank
USD TL 18.60 10% , 12%
GBP TL 21.92 5% , 2%
Euro TL 19.22 8% , 5%
print("1: USD to TL") print("2: GBP TO TL") print("3: Euro to TL") choice = int(input("choose currency ")) if(choice==1): usd = int(input("how much USD?")) tl = usd * 18.60 agentc = tl * 0.10 bankc = tl * 0.12 print("Bank will give ",round(tl-bankc)) print("Agent will give ",round(tl-agentc)) if(agentc<bankc): print("Agent preferred") else: print("Bank preferred") elif(choice==2): usd = int(input("how much USD?")) tl = usd * 21.92 agentc = tl * 0.05 bankc = tl * 0.02 print("Bank will give ",round(tl-bankc)) print("Agent will give ",round(tl-agentc)) if(agentc<bankc): print("Agent preferred") else: print("Bank preferred") elif(choice==3): usd = int(input("how much USD?")) tl = usd * 19.22 agentc = tl * 0.08 bankc = tl * 0.05 print("Bank will give ",round(tl-bankc)) print("Agent will give ",round(tl-agentc)) if(agentc<bankc): print("Agent preferred") else: print("Bank preferred") else: print("Invalid currency selection")
Allow users the select the MacBook model and customize it as per the:
1. MacBook Air:
- Basic Price = 2000$
- RAM – 8GB (default), 16 GB (+400$), 32 GB (+800$)
- SSD – 256GB (default), 512 GB (+800$), 1TB GB (+1600$)
2. MacBook Pro:
- Basic Price = 2500$
- RAM – 8GB (default), 16 GB (+500$), 32 GB (+1000$)
- SSD – 256GB (default), 512 GB (+800$), 1TB GB (+1200$)
price=0 print("1: Macbook Air") print("2: Macbook Pro") choice = int(input("select the product :")) if(choice==1): print("1: 8GB") print("2: 16GB +400$") print("3: 32GB +800$") ram = int(input("Select: RAM for Macbook Air")) if(ram==1): priceram = 0 elif(ram==2): priceram = 400 elif(ram==3): priceram = 800 else: print("not a RAM option") print("1: 256GB") print("2: 512GB +800$") print("3: 1TB +1600$") ssd = int(input("Select: SSD for Macbook Air")) if(ssd==1): pricessd = 0 elif(ssd==2): pricessd = 800 elif(ssd==3): pricessd = 1600 else: print("not a SSD option") totalprice = 2000 + priceram + pricessd print("Total Price of Macbook Air is: ",totalprice) if(choice==2): print("1: 8GB") print("2: 16GB +500$") print("3: 32GB +1000$") ram = int(input("Select: RAM for Macbook Pro")) if(ram==1): priceram = 0 elif(ram==2): priceram = 400 elif(ram==3): priceram = 800 else: print("not a RAM option") print("1: 256GB") print("2: 512GB +800$") print("3: 1TB +1200$") ssd = int(input("Select: SSD for Macbook Pro")) if(ssd==1): pricessd = 0 elif(ssd==2): pricessd = 800 elif(ssd==3): pricessd = 1200 else: print("not a SSD option") totalprice = 2500 + priceram + pricessd print("Total Price of Macbook Pro is: ",totalprice)