0% found this document useful (0 votes)
3 views

3 Mini Python Projects

The document outlines three mini Python projects: a Rock, Scissors, Paper game that allows user input and compares it with a computer's choice; a Hotel Expenses distribution calculator that computes the share of expenses among flatmates; and a simple Hotel Management system that takes food orders from a menu and calculates the total cost based on user selections.

Uploaded by

hamzadawood05oct
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

3 Mini Python Projects

The document outlines three mini Python projects: a Rock, Scissors, Paper game that allows user input and compares it with a computer's choice; a Hotel Expenses distribution calculator that computes the share of expenses among flatmates; and a simple Hotel Management system that takes food orders from a menu and calculates the total cost based on user selections.

Uploaded by

hamzadawood05oct
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

3 Mini Python Projects

# Project 1Rock, Scissors, Paper game

import random

item_list = ["Rock" , "Paper" , "Scissor"]

user_choice = input("Enter your choice: Rock, Paper, Scissor:")

computer_choice = random.choice(item_list)

print(f"You chose {user_choice}, computer chose {computer_choice}")

if user_choice == computer_choice:

print("The match is draw as both give the same input")

elif user_choice == "Rock":

if computer_choice == "Paper":

print("Computer won the game as paper covered the rock")

else:

computer_choice == "Scissor"

print("You won as the rock break the scissor")

elif user_choice == "Paper":

if computer_choice == "Rock":

print("You win as paper covered rock")

else:

computer_choice == "Scissor"

print("Computer won as scissor cut the paper")

elif user_choice == "Scissor":

if computer_choice == "Rock":

print("Computer win as rock smashed the scissor")

else:
computer_choice == "Paper"

print("You win as scissor cut the paper")

#Project 2 Hotel Expenses distribution

#inputs we need are hostel rent, food, electricity bill,charge per unit of electricity,people in the flat

rent = int(input("Enter the rent of the hostel:"))

food = int(input("Enter the food bill:"))

electricity = int(input("Enter the electricity bill;"))

people = int(input("Enter the number of people living in the flat:"))

#calculating the total distribution

total_distribution = rent + food + electricity

#calculating the share of each person

share = float(total_distribution/people)

print(share)

#Project 3 Hotel Management

# define the menu of the restaurant

menu = {

"Burger": 10.99,

"Pizza": 12.99,

"Salad": 8.99,

"Fries": 3.99,

"Soda": 2.99,
}

# Greet

print("Welcome to our restaurant!")

print("Pizza is $12.99\nBurger is $10.99\nSalad is $8.99\nFries are $3.99\nSoda is $2.99")

order_total = 0

# Ask for order

item_1 = input("What would you like to order?")

# Calculate the total

if item_1 in menu:

order_total += menu[item_1]

print(f"Your order of {item_1} is placed.")

else:

print(f"Sorry, the {item_1} is not available.")

another_order = input("Would you like anything else? (yes/no)")

if another_order == "yes":

item_2 = input("What would you like to order?")

if item_2 in menu:

order_total += menu[item_2]

print(f"Your order of {item_2} is placed.")

else:

print(f"This {item_2} is not available.")

print(f"Your total amount is {order_total}")

You might also like