Python - 6 To 15
Python - 6 To 15
Develop a program that takes as input an hourly wage and the number of hours an employee worked
in the last week. The program should compute and return the employee’s pay. Overtime work is calculated
as: any hours beyond 40 but less than or equal 60 should be paid at 1.5 times the regular hourly wage.
Any hours beyond 60 should be paid at 2 times the regular hourly wage.
class BankAccount:
def __init__(self, balance=0):
self.balances = balance
while loop_runner:
print("\nBank Account")
print("Operations\n 1. Withdraw\n 2. Deposit\n 3. Balance\n 4. To Exit")
option = int(input("Choice: "))
if option == 1:
account.withdraw(int(input("Enter the amount: ")))
elif option == 2:
account.deposit(int(input("Enter the amount: ")))
elif option == 3:
account.balance()
else:
loop_runner = False
8) bike rental
a=0
net = 0
while (a < 4):
bill = 0
print("Chooses any of the following Services\n")
a = int(input("1: View Bike onsale \n2: View Prices \n3: Place orders \n4: Exit \n"))
if a == 1:
print("The Bikes Avail are\n")
for i in bikes:
print(i)
elif a == 2:
print("The prices at our store are: \n1. Hourly----100\n2. Daily----500\n3.
Weekly---2500\n Family pack gets 30% discount on 3-5 bikes\n")
elif a == 3:
print("Choose your rental type:\n1. Hourly\n2. Daily\n3. Weekly\n")
c = int(input("Enter your option:\n"))
d = int(input("Enter the number of bikes(put within 3-5 to avail family pack option):\n"))
if c == 1:
bill += 100*d
print("Your actuall Bill is ", bill)
print("-----------------------------")
elif c == 2:
bill += 500*d
print("Your actuall Bill is ", bill)
print("-----------------------------")
elif c == 3:
bill += 2500*d
print("Your actuall Bill is ", bill)
print("-----------------------------")
else:
print("Enter a valid option")
print("-----------------------------")
if d in range(3,6):
print("Do you wanna avail family pack discount?\n")
dis = input("y for YES\nn for NO\n")
print("-----------------------------")
if dis == "y":
bill = bill*0.7
else:
bill = bill
print("Thanks for purchasing", bill, "is your bill, pay on checkout")
else:
break
9) open the file and count the number of word, line and number charecter in file
f="file.txt"
f=open("file.txt",'r')
w=0
l=0
c=0
for line in f:
word= line.split()
w+=len(word)
l+=1
c+=len(line)
print(f"number of word{w}")
print(f"number of charecter{c}")
print(f"number of line{l}")
import requests
from bs4 import BeautifulSoup
response = requests.get(url)
# Parse the HTML response with BeautifulSoup
soup = BeautifulSoup(response.content, 'html.parser')
# # Find all the image tags and extract the 'src' attribute
image_links = []
x=soup.find('img')
for i in soup.find_all('img'):
image_links.append(i['src'])
print(image_links)
12)import turtle
def main():
my_turtle = turtle.Turtle()
my_win = turtle.Screen()
my_points = [[0,0], [100,100], [200,0]]
sierpinski(my_points, 3, my_turtle)
my_win.exitonclick()
main()
13)
import turtle
turtle.speed(0)
turtle.penup()
turtle.goto(0,0)
turtle.pendown()
turtle.hideturtle()
turtle.done()
15)
import tkinter as tk
def cal():
wt=float(we.get())
ht=float(he.get())
out=round(ht/(wt*2),2)
t=tk.Label(root,text="GMI")
t.grid(row=3,column=0)
ans=tk.Label(root,text=out)
ans.grid(row=3,column=1)
root=tk.Tk()
btn=tk.Button(root,text="click me",command=cal)
btn.grid(row=2,columnspan=2)
root.mainloop()