Challenge
Seeded simulation
…count the kinds in a dict called by_kind , and print them sorted after the total: Glitches in 100 readings: 5 DROPOUT: 3 SPIKE: 2 Call random.choice() only for glitches. Look at the total: it is no…
Showing 21–27 of 27
Challenge
…count the kinds in a dict called by_kind , and print them sorted after the total: Glitches in 100 readings: 5 DROPOUT: 3 SPIKE: 2 Call random.choice() only for glitches. Look at the total: it is no…
Challenge
…than once. Collect them in a second set and print them sorted, or none : EV-1001 Hatch closed EV-1002 Cabin pressure nominal EV-1003 Abort system armed EV-1004 Switched to internal power Duplicates…
Quiz
…What can go in a set, frozenset , set comprehensions and sorting the items of a set How it works 15 questions: 11 with one correct answer, 4 where you select every correct answer After each question…
Quiz
…and how to build a new one instead count() , index() , sorting, nested tuples and divmod() How it works 15 questions: 11 with one correct answer, 4 where you select every correct answer After each…
Challenge
…that doesn't belong there at all. A router script sorts each file into its folder. Route files by their extension, then make the router cope with the names people and cameras actually produce. By…
Challenge
…2026-03-14T09:30:05Z . Machines love it, because it sorts correctly as text, and people find it hard to read. Cut the date and the time of day out of it, then show them the way the ground team writes…
Article Python Fundamentals
…when you need a quick throwaway function, for example when sorting a list. Anything a lambda can do, a normal def can do too, and the def version is usually easier to read. Leave lambdas for later…