Skip to content

Commit 2c89a56

Browse files
authored
Add files via upload
Exam in Basic Python Include the conditions
0 parents  commit 2c89a56

12 files changed

+156
-0
lines changed
257 KB
Binary file not shown.
256 KB
Binary file not shown.

03. Cat Life_Условие.docx

255 KB
Binary file not shown.
255 KB
Binary file not shown.

05. Puppy Care_Условие.docx

257 KB
Binary file not shown.

06. Gold Mine_Условие.docx

259 KB
Binary file not shown.

1_Programming_Book.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#Книгата се състои от 899 страници и 2 корици
2+
#намаление (в проценти)
3+
#трябва да се заплати на дизайнер
4+
5+
price_per_page = float(input())
6+
price_per_cover = float(input())
7+
discount_for_printing = int(input())
8+
price_for_designer = float(input())
9+
percent_from_total_price_paid_by_team = int(input())
10+
11+
start_price_for_printing = (price_per_page * 899) + (price_per_cover * 2)
12+
discounted_price_for_printing = start_price_for_printing * (1 - (discount_for_printing / 100))
13+
costs_with_designer = discounted_price_for_printing + price_for_designer
14+
15+
total_price = costs_with_designer * (1 - (percent_from_total_price_paid_by_team / 100))
16+
17+
print(f"Avtonom should pay {total_price :.2f} BGN.")

2_Beer_And_Chips.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#една бира е 1.20 лв., а цената на един пакет чипс е
2+
# равна на 45% от общата стойност на закупените бири.
3+
# Общата цена на чипса да се закръгли до по-голямо число.
4+
import math
5+
6+
football_fan_name = input()
7+
budget = float(input())
8+
number_beers = int(input())
9+
number_packs_chips = int(input())
10+
11+
total_beers_price = number_beers * 1.20
12+
price_per_chips = total_beers_price * 0.45
13+
total_price_chips = math.ceil(price_per_chips * number_packs_chips)
14+
15+
goods_cost = total_price_chips + total_beers_price
16+
17+
18+
if budget >= goods_cost:
19+
print(f"{football_fan_name} bought a snack and has {(budget - goods_cost):.2f} leva left.")
20+
else:
21+
print(f"{football_fan_name} needs {(goods_cost - budget):.2f} more leva!")

3_Cat_Life.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 6 човешки месеца се равняват на 1 котешки месец
2+
import math
3+
4+
cat_breed = input() #"British Shorthair", "Siamese"
5+
gender_cat = input() #f or m
6+
7+
result = 0
8+
9+
if cat_breed == "British Shorthair":
10+
if gender_cat == "m":
11+
result = math.floor(13 * 12) / 6
12+
elif gender_cat == "f":
13+
result = math.floor(14 * 12) / 6
14+
print(f"{math.floor(result)} cat months")
15+
elif cat_breed == "Siamese":
16+
if gender_cat == "m":
17+
result = math.floor(15 * 12) / 6
18+
elif gender_cat == "f":
19+
result = math.floor(16 * 12) / 6
20+
print(f"{math.floor(result)} cat months")
21+
elif cat_breed == "Persian":
22+
if gender_cat == "m":
23+
result = math.floor(14 * 12) / 6
24+
elif gender_cat == "f":
25+
result = math.floor(15 * 12) / 6
26+
print(f"{math.floor(result)} cat months")
27+
elif cat_breed == "Ragdoll":
28+
if gender_cat == "m":
29+
result = math.floor(16 * 12) / 6
30+
elif gender_cat == "f":
31+
result = math.floor(17 * 12) / 6
32+
print(f"{math.floor(result)} cat months")
33+
elif cat_breed == "American Shorthair":
34+
if gender_cat == "m":
35+
result = math.floor(12 * 12) / 6
36+
elif gender_cat == "f":
37+
result = math.floor(13 * 12) / 6
38+
print(f"{math.floor(result)} cat months")
39+
elif cat_breed == "Siberian":
40+
if gender_cat == "m":
41+
result = math.floor(11 * 12) / 6
42+
elif gender_cat == "f":
43+
result = math.floor(12 * 12) / 6
44+
print(f"{math.floor(result)} cat months")
45+
46+
else:
47+
result = "invalid"
48+
print(f"{cat_breed} is invalid cat!")
49+

4_Gifts_from_Santa.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# for loop
2+
3+
# • N – цяло число – 0 <= N < M
4+
# • M – цяло число – N < M <= 10000
5+
# S – цяло числo – N <= S <= M
6+
n = int(input())
7+
m = int(input())
8+
s = int(input())
9+
10+
11+
for num in range(m, n + 1, -1):
12+
if num == s and (num % 2 == 0 and num % 3 == 0):
13+
break
14+
15+
16+
elif num % 2 == 0 and num % 3 == 0:
17+
print(f"{num}" , end=" ")
18+
num += 1
19+
20+
21+
22+

5_Puppy_Care.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#while loop
2+
dog_food_bought_kg = int(input())
3+
4+
dog_food_bought_grams = 0
5+
dog_food_grams = 0
6+
command = input()
7+
8+
dog_food_bought_grams = dog_food_bought_kg * 1000
9+
current_grams = 0
10+
while command != "Adopted":
11+
dog_food_grams = int(command)
12+
13+
current_grams += dog_food_grams
14+
command = input()
15+
16+
if dog_food_bought_grams >= current_grams :
17+
left_food = dog_food_bought_grams - current_grams
18+
print(f"Food is enough! Leftovers: {left_food} grams.")
19+
else:
20+
needed_food = current_grams - dog_food_bought_grams
21+
print(f"Food is not enough. You need {needed_food} grams more.")

6_Gold_Mine.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# приема броя на локациите и
2+
# очакван среден добив на злато за ден за една локация
3+
4+
number_locations = int(input())
5+
6+
total_gold_digg_days = 0
7+
average_gold_taken = 0
8+
total_days_of_mining = 0
9+
10+
for each_location in range(number_locations):
11+
average_gold_a_day_expected = float(input())
12+
days_of_mining = int(input())
13+
14+
total_days_of_mining += days_of_mining
15+
16+
for each_day in range(days_of_mining):
17+
gold_digg_a_day = int(input())
18+
19+
total_gold_digg_days += gold_digg_a_day
20+
average_gold_taken = total_gold_digg_days / total_days_of_mining
21+
22+
if average_gold_taken >= average_gold_a_day_expected:
23+
print(f"Good job! Average gold per day: {average_gold_taken:.2f}.")
24+
else:
25+
gold_not_enough = average_gold_a_day_expected - average_gold_taken
26+
print(f"You need {gold_not_enough:.2f} gold.")

0 commit comments

Comments
 (0)