Skip to content

Shipping-boxes #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Week 2 challenge
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#request user for number of books
books=int(input("enter number books : \n"))
print("you have entered",books,"books")
#requesting user for the height of a single book
heightb=float(input("enter height of a book in inches : \n"))
print("you have entered",heightb,"inches per book")

#height of boxes
Bigbox=float(input("enter height of big box in inches eg 7.5 : \n"))
print("you have entered",Bigbox,"inches as height for the big box")

smallbox=float(input("enter height of small box in inches eg 7.5 : \n"))
print("you have entered",smallbox,"inches as height for the small box")

totalh=books*heightb
print ("the total height is ",totalh,"inches")


#if we are using the big boxes
if totalh >= Bigbox:

if totalh%Bigbox == 0:
x=totalh/Bigbox
rndx=round(x)
print(rndx,"Big boxes")
#where a big and a small box are needed

elif totalh%Bigbox !=0:
#calculate big boxes needed
x=totalh/Bigbox
rndx=round(x)
print(rndx,"Big boxes")
#to calculate small boxes
m=totalh%Bigbox

rem=m/smallbox
rndrem=round(rem)
print(rndrem,"small boxes")

#if using the small boxes
elif totalh < Bigbox:
a=totalh/smallbox
rnda=round(a)
print(rnda,"small boxes")
else:
print("seek help")