aboutsummaryrefslogtreecommitdiff
path: root/Python/Beginner training/Exam 2.py
diff options
context:
space:
mode:
authorSyndamia <kami02882@gmail.com>2019-07-14 18:24:40 +0300
committerSyndamia <kami02882@gmail.com>2019-07-14 18:24:40 +0300
commit65edf7296baf48aad1b4e0c09b57f1a7f48791a8 (patch)
tree0c163496769d66363a4907cab3e72f42e5030c75 /Python/Beginner training/Exam 2.py
parenta0addea2b7bbdac244420ec917c0f3c14c4c8831 (diff)
downloadSelf-learning-65edf7296baf48aad1b4e0c09b57f1a7f48791a8.tar
Self-learning-65edf7296baf48aad1b4e0c09b57f1a7f48791a8.tar.gz
Self-learning-65edf7296baf48aad1b4e0c09b57f1a7f48791a8.zip
Combined exam exercises files into one file, added a file for OOP exercises
Diffstat (limited to 'Python/Beginner training/Exam 2.py')
-rw-r--r--Python/Beginner training/Exam 2.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/Python/Beginner training/Exam 2.py b/Python/Beginner training/Exam 2.py
new file mode 100644
index 0000000..c3d20bd
--- /dev/null
+++ b/Python/Beginner training/Exam 2.py
@@ -0,0 +1,48 @@
+import sys
+import math
+import random
+import os
+
+def FitnessEquipment():
+ total_sum = 0.0
+ for x in range(int(input())):
+ item_name = input()
+
+ if item_name == "treadmill":
+ total_sum += 5899
+ elif item_name == "cross trainer":
+ total_sum += 1699
+ elif item_name == "exercise bike":
+ total_sum += 1789
+ elif item_name == "dumbells":
+ total_sum += 579
+ else:
+ print("ERROR, Invalid product name")
+
+ print(round(total_sum, 2))
+
+def FitnessVisitors():
+ names = list(input("Type names: ").split(", "))
+
+ while True:
+ command = input()
+ if command == "END": break
+
+ if command == "Add visitor":
+ names.append(input())
+ elif command == "Add visitor on position":
+ name_to_insert = input()
+ names.insert(int(input()), name_to_insert)
+ elif command == "Remove visitor on position":
+ names.pop(int(input()))
+ elif command == "Remove last visitor":
+ names.pop(len(names) - 1)
+ elif command == "Remove first visitor":
+ names.pop(0)
+ else:
+ print("ERROR, indxistant command")
+
+ print(names)
+
+FitnessEquipment()
+FitnessVisitors() \ No newline at end of file