Article Mini projects
Medical dispenser - Don’t trust the user
…self.dose_history if d.date() == current_time.date()] if len(today_doses) >= self.max_daily_doses: return "ACCESS DENIED: Daily limit reached" # Dispense the medication…
Showing 11–20 of 68
Article Mini projects
…self.dose_history if d.date() == current_time.date()] if len(today_doses) >= self.max_daily_doses: return "ACCESS DENIED: Daily limit reached" # Dispense the medication…
Challenge
…list of units and warn when the lists don't have the same length, since zip() quietly stops at the shortest.
Challenge
…'mean': 419.5} Build the dict in the return line, with len() , min() , max() and sum() / len() . No data, and a rounded mean The second pass had no data, and min([]) stops with a ValueError . For an…
Challenge
…0.5, then add a third waypoint and print each leg and the length of the whole route.
Challenge
…shifts: 0 Count the shifts in slot as you go: crew[slot % len(crew)] wraps round to the first person after the last. {name:<10} pads the names into columns. Days off, fairly Now some of the crew have…
Challenge
…convert leg 2 before it's added. It must print: Trajectory length: 386,294 km Make: Landing in metres A lander's altitude comes from its radar in metres, but the backup sensor reports the descent rate…
Challenge
…419.5 Inside the function, values is a tuple, so sum() and len() work on it. In the second call, average(*readings) passes the five readings as five separate arguments. An option after the values Add…
Quiz
…quiz covers Indexing from the front and the back, slicing, len() and in Changing items, append() , insert() and extend() Removing items with pop() and remove() sort() vs sorted() , min() , max() and…
Article Python Fundamentals
…loop: check systems in the rover for system_id in range(len(systems)): system_name = systems[system_id] # Randomly generate status (80% chance of OK) is_working = random.random() > 0.2 if is_working…
Article Mini projects
…astronaut = self.astronaut_var.get().split(' - ') if len(astronaut) != 2: messagebox.showerror("Error", "Please select an astronaut!") return astronaut_id = astronaut[0] date = self.date_entry.get()…