Example
Type Conversion
Changing data types using int(), float() and str() functions. Converting between types.
Showing 211–220 of 237
Example
Changing data types using int(), float() and str() functions. Converting between types.
Example
Learning to import modules in Python. Modules extend your program capabilities.
Example
Classic first program in any programming language. Your first step into Python space.
Challenge
Add a docstring to fuel_needed() that says what it returns and what the reserve means, then add type hints for its parameters and return value; the tests read both from the function itself.
Challenge
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Example
Functions can return complex data structures like dictionaries or lists.
Example
Combining regular parameters, *args and **kwargs in one function.
Example
Docstrings describe what a function does. Good programming practice.
Example
Looping through keys, values or key-value pairs of a dictionary.
Example
Python recognizes different data types automatically. Learn int, float, str and bool.