Challenge
Manifest validator
Write problems(item), which lists everything wrong with one cargo item: missing fields, a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate…
Showing 21–30 of 57
Challenge
Write problems(item), which lists everything wrong with one cargo item: missing fields, a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate…
Example
Dictionaries store data as key-value pairs. Fast access to data by key.
Challenge
The monitoring system raises the same alert over and over. Group repeats of an alert that come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the…
Quiz
Free Python quiz for beginners: 20 multiple-choice questions on print(), strings, lists, dictionaries, loops and functions, with instant answers.
Example
Functions can return complex data structures like dictionaries or lists.
Example
Operator ** allows accepting any number of keyword arguments.
Article Python Fundamentals
…you fix it once. Find a bug in copy-pasted code and you get to hunt down every copy. You will miss one. Everybody does. Your code starts to read like a plan. A line like fuel =…
Example
When to use tuples instead of lists? Comparison of properties and applications.
Article Mini projects
…Just add 273.15 to the temperature in degrees Celsius to get the temperature in Kelvin. These scales differ only in the placement of the zero point. The formula for converting temperature in degrees…
Example
Adding, changing and removing dictionary elements in Python.