The goal of this project was to calculate the fair share of each person in paying a restaurant bill.
print("Welcome to the tip calculator!")
bill = float(input("What was the total bill? $"))
tip = int(input("What percentage tip would you like to give? 10 12 15 "))
people = int(input("How many people to split the bill? "))
result = (bill * (1+tip/100)) / people
print(f"Each person should pay: ${round(result, 2)}")
Welcome to the tip calculator! Each person should pay: $58.3
In this project, the goal was to automate the billing of pizza depending on the orders, in an automated fashion.
print("Welcome to Python Pizza Deliveries!")
size = input("What size pizza do you want? S, M or L: ")
pepperoni = input("Do you want pepperoni on your pizza? Y or N: ")
extra_cheese = input("Do you want extra cheese? Y or N: ")
if size == "S":
bill = 15
if pepperoni == "Y":
bill += 2
elif extra_cheese == "Y":
bill += 1
elif size == "M":
bill = 20
if pepperoni == "Y":
bill += 3
if extra_cheese == "Y":
bill +=1
elif size == "L":
bill = 25
if pepperoni == "Y":
bill += 3
elif extra_cheese == "Y":
bill += 1
print(f"Your final bill is: ${bill}.")
Welcome to Python Pizza Deliveries! Your final bill is: $17.
The goal of this project is to code a game, which follows the following logic:
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")
left_or_right = input("Left or right?")
if left_or_right == 'left':
swim_or_wait = input("swim or wait")
if swim_or_wait == 'wait':
which_door = input("Which door? Red, yellow, or blue?")
if which_door == 'red':
print('Burned by fire. Game over.')
elif which_door == 'blue':
print('Eaten by beasts. Game over.')
elif which_door == 'yellow':
print('You win!')
else: print('Game over.')
else: print('You were attacked by a trout. Game over')
else: print("You fall into a hole. Game over.")
Welcome to Treasure Island. Your mission is to find the treasure. You fall into a hole. Game over.
In this project, I programmed a simple rock, paper, scissors game. The user is asked for an input and competes against the computer.
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
import random
choices = ['rock', 'paper', 'scissors']
human_choice = input("Which one do you choose? rock, paper, or scissors? Make your choice now").lower()
computer_choice = random.choices(choices)[0]
if human_choice == 'rock' and computer_choice == 'rock':
print(f'Your choice: \n {rock}')
print(f'The computer chose: \n {rock}')
print('Play again!')
elif human_choice == 'paper' and computer_choice == 'paper':
print(f'Your choice: \n {paper}')
print(f'The computer chose: \n {paper}')
print('Play again!')
elif human_choice == 'scissors' and computer_choice == 'scissors':
print(f'Your choice: \n {scissors}')
print(f'The computer chose: \n {scissors}')
print('Play again!')
elif human_choice == 'rock' and computer_choice == 'paper':
print(f'Your choice: \n {rock}')
print(f'The computer chose: \n {paper}')
print('You loose!')
elif human_choice == 'rock' and computer_choice == 'scissors':
print(f'Your choice: \n {rock}')
print(f'The computer chose: \n {scissors}')
print('You win!')
elif human_choice == 'paper' and computer_choice == 'rock':
print(f'Your choice: \n {paper}')
print(f'The computer chose: \n {rock}')
print('You win!')
elif human_choice == 'paper' and computer_choice == 'scissors':
print(f'Your choice: \n {paper}')
print(f'The computer chose: \n {scissors}')
print('You loose!')
elif human_choice == 'scissors' and computer_choice == 'rock':
print(f'Your choice: \n {scissors}')
print(f'The computer chose: \n {rock}')
print('You loose!')
elif human_choice == 'scissors' and computer_choice == 'paper':
print(f'Your choice: \n {scissors}')
print(f'The computer chose: \n {paper}')
print('You win!')
Your choice: _______ ---' ____) (_____) (_____) (____) ---.__(___) The computer chose: _______ ---' ____)____ ______) _______) _______) ---.__________) You loose!