- Automates the recipient writing part in the same letter.
- Recipient names are given in a separate file named invited_names.txt
- A sample letter is given in a separate file named starting_letter.txt
- Code is to be written inside main.py whose purpose is to fetch the sample letter, replace the [name] in a sample letter with recipient names & generate an individual letter following this naming convention: letter_for_{recipient_name}.txt
- The number of names given in invited_names.txt file generates a similar number of letters. Suppose, 5 names are given in invited_names.txt then, 5 letters will be generated.
Search This Blog
Python Mail Merge Project - Automating Recipient Writing in a Letter
Crossing the Turtle : Python Turtle Project for Beginners
- One turtle of unique color can only move forward.
- Neither left nor right. Turtle cannot even move backward.
- Turtle has to save itself from the collision with cars.
- If crosses all the cars, its level increases & along with all the car's speed!
- Random count cars & each car of random color are coming from the left & right.
- The scoreboard is maintained for every level.
How the game looks like?
Turtle Race : Python Project for Beginners
1. 5 turtles of unique colors compete against each other.
2. User gets a chance to guess which color turtle will win the race.
3. If the user's guess is right it says you've won otherwise you lose!
Few screenshots of the game:
Doodle it: Imagine, Draw, Erase and Repeat - Python Project for Beginners
In order to create this game first step is to know a way of being able to listen to things the user does, like when a user taps a specific key on the keyboard. And the code that allows us to do this are called Event Listeners.
Go to python documentation > listen method()
It has a whole bunch of section-on-screen events, including listening to key presses or listening to a click or other things that you can listen to. So the important thing is this listen method.
Object Oriented Quiz Project - Python
QUIZ GAME RULES:
- In this quiz project, there is a total of 12 questions. And on the basis of the user's typed answer, the score will be awarded to them. Each question is of 1 mark. The answer can be either True or False.
- The program is using an object-oriented approach.
- When a user types the wrong or right answer, share these remarks with them:
- If wrong: print("That's wrong")
- If right: print("You got it right!")
- You've completed the quiz.
- Your final score was: final_score/question_number
# TODO 1: the list to store the question data
# TODO 2: import all the dependent classes, methods
# TODO 3: Get the data from the dat.py and allocate the memory to the data(question, answer)
# TODO 4: Append each allocated data to the list
# TODO 5: Pass the question list to the quiz brain for actions
# TODO 6: Continue asking questions until the end of the question list
# TODO 7: Display the final score and quiz is ended remark
Code- main.py :
# TODO 1: asking the questions
# TODO 2: checking if the answer was correct
# TODO 3: checking if we're at the end of the quiz
Code- quiz_brain.py :
Object Oriented Coffee Maker Machine : Python

The functionality given to the virtual coffee machine is a replica of our actual coffee machine. But, this oops-oriented coffee machine can only take order one out of latte/espresso/cappuccino.
The code is designed after determining 5 conditions to serve the coffee:
- Turn On & Off the machine
- Print the available quantity of the resources & money
- Process the made payment by the user
- Here, check out the given payment is ok?
- Serve the coffee
MenuItem Class
Attributes:
- name
(str) The name of the drink.
e.g. “latte”
- cost
(float) The price of the drink.
e.g 1.5
- ingredients
(dictionary) The ingredients and amounts required to make the drink.
e.g. {“water”: 100, “coffee”: 16}
Menu Class
Methods:
- get_items()
Returns all the names of the available menu items as a concatenated string.
e.g. “latte/espresso/cappuccino”
- find_drink(order_name)
Parameter order_name: (str) The name of the drinks order.
Searches the menu for a particular drink by name. Returns a MenuItem object if it exists, otherwise returns None.
CoffeeMaker Class
Methods:
- report()
Prints a report of all resources.
e.g.
Water: 300ml
Milk: 200ml
Coffee: 100g
- is_resource_sufficient(drink)
Parameter drink: (MenuItem) The MenuItem object to make.
Returns True when the drink order can be made, False if ingredients are insufficient.
e.g.
True
- make_coffee(order)
Parameter order: (MenuItem) The MenuItem object to make.
Deducts the required ingredients from the resources.
MoneyMachine Class
Methods:
- report()
Prints the current profit
e.g.
Money: $0
- make_payment(cost)
Parameter cost: (float) The cost of the drink.
Returns True when payment is accepted, or False if insufficient.
e.g. False
is_on=True
while is_on:
options = menu.get_items()
choice = input(f"What would you like? ({options}):").lower()
if choice =='off':
is_on = False
2. Print the available quantity of the resources & money - The final report
from menu import Menu, MenuItem
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
coffee = CoffeeMaker()
money = MoneyMachine()
menu = Menu()
is_on = True
while is_on:
options = menu.get_items()
choice = input(f"What would you like? ({options}):").lower()
if choice =='off':
is_on = False
elif choice == 'report':
money.report()
coffee.report()3. & 4. Process the made payment by the user. Also, check out the given payment is ok?
from menu import Menu, MenuItem
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
coffee = CoffeeMaker()
money = MoneyMachine()
# menuitem = MenuItem()
menu = Menu()
is_on=True
while is_on:
options = menu.get_items()
choice = input(f"What would you like? ({options}):").lower()
if choice =='off':
is_on = False
elif choice == 'report':
money.report()
coffee.report()
else:
drink = menu.find_drink(choice)
if coffee.is_resource_sufficient(drink):
if money.make_payment(drink.cost):
5. Serve the coffee
from menu import Menu, MenuItem
Thank You :)
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
coffee = CoffeeMaker()
money = MoneyMachine()
menu = Menu()
is_on = True
while is_on:
options = menu.get_items()
choice = input(f"What would you like? ({options}):").lower()
if choice =='off':
is_on = False
elif choice == 'report':
money.report()
coffee.report()
else:
drink = menu.find_drink(choice)
if coffee.is_resource_sufficient(drink):
if money.make_payment(drink.cost):
coffee.make_coffee(drink)
-
Hashing to Solutions: Two Sum Longest Substring Without Repeating Characters Longest Palindromic Substring Container With Mos...
-
Hey! Here, am on Day 02 of Angela's course. Though my heading says Day 04 which is actually done to stay in order of all the python le...
-
Exploring Data Types TechGig The question asked to check out the data type of the user input. It was quite tricky as python by default conve...