def student_form(self): name = input_str_non_empty("Student Name: ") age = input_int("Student age: ", allow_negative=False, min_val=3, default=3) sex = selection_opt(OPTION_SEX, "Student gender: ") height = input_float("Student Height: ", allow_negative=False, min_val=1, default=1) weight = input_float("Student Weight: ", allow_negative=False, min_val=1, default=1) eye_color = selection_opt(OPTION_EYE_COLOR, "Student Eye color: ") hair_color = selection_opt(OPTION_HAIR_COLOR, "Student hair color: ") newStudent = Student(name, sex, age, height, weight, eye_color, hair_color) return newStudent
def new_movement(self): ready = '' while ready != 'r': clean_screen() option = self.selection_movement() clean_screen() print(option.upper()) amount = round(input_float( f"Give me the amount to {option}: ", min_val=20, default=20), 2) round(amount, 3) if option.lower() == 'deposit': self.salary += amount self.movements.append((amount, self.salary)) print(f"Deposit of $ {amount}") else: if self.salary - amount > 0: self.salary -= amount self.movements.append((-1 * amount, self.salary)) print(f"Retirement of $ {amount}") else: print("Ups! Invalid Transaction not enough money") input("_") clean_screen() print(f"Salary: $ {self.salary}") ready = input( "[r] To exit and print the report\n[Enter] For new Transaction\n_") self.show_transactions_report()
def handle_add_ticket(): """ Function that handles to add a ticket. """ if len(clients) == 0: print("No clients register for the moment, Cant do transactions.") print("Please, Add a client") return 0 client = selection_client() t = Ticket(client.name) still = True while still: clean_screen() print(f"Client: {client.name}") print("Adding New Article") print("*" * 20) desc = input_str_non_empty("Description Article: ") amount = input_int("Amount: ", False, min_val=1, default=1) price = round( input_float("Price per product: ", False, min_val=1, default=1), 2) new_article = Article(desc, amount, price) t.add_article(new_article) still = still_bool("More Products? [y/n]: ") t.show_report()
def main(): """ Main function that handles the excersice 4. """ client_name = input("Client Name: ") t = Ticket(client_name) still = True while still: clean_screen() print(f""" Client: {client_name} """) print("Adding New Article") print("*" * 20) desc = input_str_non_empty("Description Article: ") amount = input_int("Amount: ", False, min_val=1, default=1) price = round(input_float("Price per product: ", False, min_val=1, default=1), 2) new_article = Article(desc, amount, price) t.add_article(new_article) still = still_bool("More Products? [y/n]: ") t.show_report()
def add_trip(self): print(f"Elevator Trip {len(self.trip_amount_persons) + 1}") amount = input_int("Amount of people in the elevator trip: ", allow_negative=False) weight = round( input_float("Weight in the elevator trip: ", allow_negative=False), 2) self.trip_amount_persons.append(amount) self.trip_weight.append(weight) print("Elevator Trip registered")
def handle_add(): desc = input_str_non_empty("Article Description: ") amount = input_int("Article Amount: ", False, min_val=1, default=1) ex_factor = round(input_float("Article Factor Cost: ", False), 2) base_cost = input_int("Article base cost: ", False, min_val=1, default=1) article = Article(desc, amount, ex_factor, base_cost) r.add_article(article)
def add_student(self): name = input_str_non_empty("Student name: ") califs = [] for i in range(AMOUNT_PARTIALS): n = round( input_float(f"Calification {i + 1} Partial: ", allow_negative=False, max_val=10), 2) califs.append(n) s = Student(name, califs) self.students.append(s) print(f"{name} fue agregado corectamente")
def main(): owner_name = input_str_non_empty("Name of the owner of the acount: ") init_salary = round(input_float("Initial Salary: ", False, min_val=1, default=1), 2) a = AcountStatus(owner_name, init_salary) a.new_movement()