Example
Combining Different Argument Types
Combining regular parameters, *args and **kwargs in one function.
Showing 11–20 of 21
Example
Combining regular parameters, *args and **kwargs in one function.
Article Python Fundamentals
Learn to write your own Python functions, from your first def to return values, default parameters and scope, with runnable examples, common mistakes and six practice projects.
Quiz
Free quiz on Python's print() function: 15 questions on quotes, escape characters, sep, end, flush and f-string formatting, with instant answers.
Challenge
Make abort(reason, *, confirm) refuse to run unless confirm=True is passed by name: a bare * makes confirm keyword-only and required, then an is True check refuses values that are merely truthy, such…
Example
Parameters can have default values. Used when argument is not provided.
Article Python Fundamentals
…support. Online editor with mobile-friendly interface, CLI arguments & terminal output. No sign-up required.
Quiz
…on print(), strings, lists, dictionaries, loops and functions, with instant answers.
Example
Functions enumerate() and range() extend for loop capabilities in Python.
Example
Dictionaries store data as key-value pairs. Fast access to data by key.
Article Mini projects
…how to do it. Converting Decimal to Base 6 - Your Own Function The algorithm is straightforward: keep dividing the decimal number by 6 and collect the remainders. Those remainders, read in reverse…