-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee71be2
commit 82150fb
Showing
2 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#Expense Tracker:Build an app that helps users track their daily expenses and calculate total expenses. | ||
|
||
def track_expense(): | ||
|
||
expenses = [] | ||
|
||
def createNewAcc(amount,category,date,description): | ||
expense = { | ||
"amount": amount, | ||
"category": category, | ||
"date": date, | ||
"description": description | ||
} | ||
expenses.append(expense) | ||
|
||
|
||
def viewExpenses(): | ||
print("\n") | ||
for expense in expenses: | ||
print(f'{expense}') | ||
print("\n") | ||
|
||
|
||
def calculateSum(): | ||
total = sum(expense["amount"] for expense in expenses) | ||
print(f"\nTotal: {total}\n") | ||
|
||
|
||
def filteredExpense(): | ||
category = input("\nEnter the category you want to filter=").lower() | ||
found = False | ||
for expense in expenses: | ||
if expense['category'] == category: | ||
print(f"\n{expense}\n") | ||
found = True | ||
if not found: | ||
print("Category doesn't exists!!\n") | ||
|
||
|
||
|
||
print("Welcome to Expense Tracker") | ||
while True: | ||
print("1. Add new expense") | ||
print("2. View all expenses") | ||
print("3. Calculate sum of total expenses") | ||
print("4. Filter expenses by category") | ||
print("5. Exit") | ||
|
||
try: | ||
user_input = int(input("Enter your choice=")) | ||
except ValueError: | ||
print("Enter a valid choice!") | ||
|
||
if user_input == 1: | ||
#amount category date description | ||
amount = int(input("\nEnter the amount=")) | ||
category = input("Enter the category=") | ||
date = input("Enter date (YYYY-MM-DD):") | ||
description = input("Enter description for it=") | ||
createNewAcc(amount,category,date,description) | ||
print("Your expense has been stored successfully!\n") | ||
|
||
elif user_input == 2: | ||
viewExpenses() | ||
|
||
elif user_input == 3: | ||
calculateSum() | ||
|
||
elif user_input == 4: | ||
filteredExpense() | ||
|
||
elif user_input == 5: | ||
print("Welcome Again🤗!") | ||
exit() | ||
|
||
else: | ||
print("Welcome🤗") | ||
break | ||
|
||
|
||
track_expense() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Unit Converter:Create a program that converts between different units (length, weight, temperature, etc.). | ||
|
||
def lengthConverter(): | ||
print("\nLength Conversion:") | ||
print("1.Meters to Kilometers") | ||
print("2.Kilometers to Miles") | ||
print("3.Miles to Yards\n") | ||
|
||
x = float(input("Enter your choice=")) | ||
y = int(input("Enter the value to convert=")) | ||
|
||
if x == 1: | ||
res = y/1000 | ||
print(f"The {y} Meters is equal to {res} Kilometers.") | ||
|
||
elif x == 2: | ||
res = y*0.621 | ||
print(f"The {y} Kilometers is equal to {res} Miles.") | ||
|
||
elif x == 3: | ||
res = y * 1760 | ||
print(f"The {y} Miles is equal to {res} Yards.") | ||
|
||
else: | ||
print("Please enter a valid choice!!") | ||
|
||
def weightConverter(): | ||
print("\nWeight Conversion:") | ||
print("1. Kilograms to Pounds") | ||
print("2. Pounds to Ounces") | ||
print("3. Grams to Kilograms\n") | ||
|
||
x = int(input("Enter your choice=")) | ||
y = int(input("Enter the value to convert=")) | ||
|
||
if x == 1: | ||
res = y*2.20 | ||
rounded_value = round(res,2) | ||
print(f"The {y} kilogram is equal to {rounded_value} Pounds.") | ||
|
||
elif x == 2: | ||
res = y*16 | ||
print(f"The {y} Pounds is equal to {res} Ounces.") | ||
|
||
elif x == 3: | ||
res = y/1000 | ||
print(f"The {y} Grams is equal to {res} Kilograms.") | ||
|
||
else: | ||
print("Please enter a valid choice!!") | ||
|
||
def tempConverter(): | ||
print("\nTemperature Conversion:") | ||
print("1. Celsius to Fahrenheit") | ||
print("2. Fahrenheit to Celsius") | ||
print("3. Celsius to Kelvin\n") | ||
|
||
x = int(input("Enter your choice=")) | ||
y = int(input("Enter the temperature value=")) | ||
|
||
if x == 1: | ||
res = (y* 9/5) + 32 | ||
print(f"The {y} celsius is equal to {res} Fahrenheit.") | ||
|
||
elif x == 2: | ||
res = (y - 32) * 5/9 | ||
print(f"The {res} Fahrenheit is equal to {res} Celsius.") | ||
|
||
elif x == 3: | ||
res = y + 273.15 | ||
print(f"The {y} celsius is equal to {res} Kelvin.") | ||
|
||
else: | ||
print("Please enter a valid choice!!") | ||
|
||
|
||
def main(): | ||
print("Welcome to Converter System😃") | ||
|
||
while True: | ||
print("\n1.Length Converter") | ||
print("2. Weight Converter") | ||
print("3. Temperature Converter\n") | ||
|
||
try: | ||
user_input = int(input("Enter your choice=")) | ||
except ValueError: | ||
print("No string or special character is allowed to enter here.") | ||
|
||
if user_input == 1: | ||
lengthConverter() | ||
|
||
elif user_input == 2: | ||
weightConverter() | ||
|
||
elif user_input == 3: | ||
tempConverter() | ||
|
||
else: | ||
print("Please enter a valid choice!!") | ||
|
||
main() |