From 65edf7296baf48aad1b4e0c09b57f1a7f48791a8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 14 Jul 2019 18:24:40 +0300 Subject: Combined exam exercises files into one file, added a file for OOP exercises --- Python/Beginner training/Exam 2.py | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Python/Beginner training/Exam 2.py (limited to 'Python/Beginner training/Exam 2.py') 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 -- cgit v1.2.3