Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pythonBasics/completed challenges/ascii_art.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pyfiglet
T = input("My name in digital Art looks like: ")
ASCII_art_1 = pyfiglet.figlet_format(T, font='alphabet')
print(ASCII_art_1)
14 changes: 14 additions & 0 deletions pythonBasics/completed challenges/barman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def greeting(name):

print(f"Nice to meet you {name}")


user_name = input("What is your name?")
greeting(user_name)

age = int(input("How old are you?"))

if age < 17:
print("Go home!")
else:
print(f"What can I get you for you, {user_name}? ")
23 changes: 23 additions & 0 deletions pythonBasics/completed challenges/ex_digital_dice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import random

def roll_dice():
return random.randint(1,6)

def display_dice(number):
dice_art=[
"+--------+",
"| |",
f"| {number} |",
"| | ",
"+--------+"
]
for line in dice_art:
print(line)

def main():
dice_result = 5
display_dice(dice_result)


if __name__ == "__main__":
main()
8 changes: 8 additions & 0 deletions pythonBasics/completed challenges/greeting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def greeting(name):

print(f"Nice to meet you {name}")


user_name = input("What is your name?")
greeting(user_name)

17 changes: 17 additions & 0 deletions pythonBasics/completed challenges/mushroom_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def work_hours(hours_work, kilos):
hourly_rate = 10.50
rate_per_kilo = 1

total_wages = (hours_work * hourly_rate) + (kilos * rate_per_kilo)
return total_wages

def main():
hours_work = float(input("How many hours was your rota?"))
kilos = float(input("How many kg did you pick up?"))
wages = work_hours(hours_work, kilos)
print(f"You have worked {hours_work} hours.")
print(f"You produced {kilos} kilos.")
print(f"Your day`s wage is {wages : .2f} £££.")

if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions pythonBasics/completed challenges/pocket_money_calcutaror.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def get_user_info():
pocket_money = float(input("Input your weekly pocket money : ££ "))
phone_bill = float(input("Input your weekly spending on phone : ££ "))
food = float(input("Input your weekly spending on food: ££ "))
meeting_friends = float(input("Input your weekly spending on friends : ££ "))
return pocket_money, phone_bill, food, meeting_friends

def calculate_spending(pocket_money, phone_bill, food, meeting_friends):

total_expenses = phone_bill + food + meeting_friends
money_left = pocket_money - total_expenses
print(f"\nMoney left: {money_left : .2f}")
print(f"You spend {total_expenses} ££")

if total_expenses == money_left:
print("You spent all money")
else:
print(f"You can save {money_left}££")

def main():
print("Welcome to pocket money calculator!")
pocket_money, phone_bill, food, meeting_friends = get_user_info()
calculate_spending(pocket_money, phone_bill, food, meeting_friends)

if __name__ == "__main__":
main()
12 changes: 12 additions & 0 deletions pythonBasics/completed challenges/selectionStatement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def selection_statement():
totalMark = 80
passrate = 60
mark1 = float(input("Enter the 1st mark: "))
score = (mark1/totalMark) * 100

if score >= passrate:
print("Congratulations")
else:
print("Try one more time")

selection_statement()
5 changes: 5 additions & 0 deletions pythonBasics/completed challenges/simple_adder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
user = int(input("Enter the first num:"))
user1 = int(input("Enter the first num:"))
print(f"You entered {user} - 1st num and {user1} - 2nd num")
sum = user + user1
print(f"The sum of {user} and {user1} is {sum}")
21 changes: 21 additions & 0 deletions pythonBasics/completed challenges/test_mark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def get_marks():
mark1 = int(input("Enter the first mark (out of 100):"))
mark2 = int(input("Enter the first mark (out of 100):"))
mark3 = int(input("Enter the first mark (out of 100):"))
return mark1, mark2, mark3

def calculate_marks(mark1, mark2, mark3):
return (mark1 + mark2 + mark3) / 3

def main():
mark1, mark2, mark3 = get_marks()
average = calculate_marks(mark1, mark2, mark3)

print("\nConfirmation:")
print(f"Mark 1 : {mark1} / 100")
print(f"Mark 2 : {mark2} / 100")
print(f"Mark 3 : {mark3} / 100")
print(f"Average : {average} / 100")

if __name__ == "__main__":
main()
16 changes: 16 additions & 0 deletions pythonBasics/completed challenges/toy_car_worker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def work_hours(hours_worked, made_toys):
hourly_rate = 9
toy_rate = 0.60

total_wages = (hours_worked * hourly_rate) + (made_toys * toy_rate)
return total_wages

def main():
hours_worked = float(input("How many hours did you work?"))
made_toys = float(input("How many toys did you do?"))
wages = work_hours(hours_worked, made_toys)
print(f"You worked {hours_worked} hours.\nYou produced {made_toys} trains.")
print(f"\nYour day`s wage is {wages : .2f} £.")

if __name__ == "__main__":
main()
15 changes: 15 additions & 0 deletions pythonBasics/completed challenges/volume_of_box.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def calculate_volume(lenght, width, height):
volume = lenght * width * height
return volume

def main():
lenght = float(input("Input the lenght: "))
width = float(input("Input the width: "))
height = float(input("Input the height: "))

volume = calculate_volume(lenght, width, height)
print(f"The volume is : {volume}")

if __name__ == "__main__":
main()