Projects¶

1. Simple Tip Calculator¶

The goal of this project was to calculate the fair share of each person in paying a restaurant bill.

In [ ]:
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

2. Python Pizza - The Automatic Pizza Order Program¶

In this project, the goal was to automate the billing of pizza depending on the orders, in an automated fashion.

In [2]:
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.

3. Treasure Island Game¶

The goal of this project is to code a game, which follows the following logic:

https://viewer.diagrams.net/index.html?highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload#%7B%22pageId%22%3A%22C5RBs43oDa-KdzZeNtuy%22%7D

In [3]:
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.

4. Rock Paper Scissors Game¶

In this project, I programmed a simple rock, paper, scissors game. The user is asked for an input and competes against the computer.

In [4]:
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!