Skip to content
Open
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions magic8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import random

name = ""
question = "Will I win the lottery?"
answer= ""

random_number = random.randint(1, 11)
#print("The random number is: ", random_number)

if random_number == 1:
answer = "Yes, definitely"
elif random_number == 2:
answer = "It is decidedly so"
elif random_number == 3:
answer = "Without a doubt"
elif random_number == 4:
answer = "Reply hazy, try again"
elif random_number == 5:
answer = "Ask again later"
elif random_number == 6:
answer = "Better not tell you now"
elif random_number == 7:
answer = "My sources say no"
elif random_number == 8:
answer = "Outlook not so good"
elif random_number == 9:
answer = "Very doubtful"
elif random_number == 10:
answer = "Why not"
elif random_number == 11:
answer = "Of course!!"
else:
answer = "Error"

if question == "":
print("The Magic 8-Ball cannot provide a fortune unless you ask it something.")
else:
if name == "":
print("Question: " + question)
else:
print(name + " asks: " + question)
print("Magic 8-Ball's answer: " + answer)
33 changes: 33 additions & 0 deletions shipping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
weight = 41.5

#Ground Shipping
flat_charge = 20

if weight <= 2:
cost_ground = weight * 1.5 + flat_charge
elif weight > 2 and weight <= 6:
cost_ground = weight *3 + flat_charge
elif weight > 6 and weight <= 10:
cost_ground = weight * 4 + flat_charge
else:
cost_ground = weight * 4.75 + flat_charge

print (f"Ground shipping cost: ${cost_ground:.2f}")

#Ground Shipping Premium
cost_ground_premium = 125.00
print (f"Ground shipping Premium cost: ${cost_ground_premium:.2f}")

#Drone Shipping
if weight <= 2:
cost_drone = weight * 4.5
elif weight > 2 and weight <= 6:
cost_drone = weight * 9
elif weight > 6 and weight <= 10:
cost_drone = weight * 12
else:
cost_drone = weight * 14.25

print (f"Drone shipping cost: ${cost_drone:.2f}")