Regular Bite Exercises Bites RSS feed

Hone your Python skills by coding and verifying exercises in the comfort of your browser.
 | Catalogue | Random Bite



Bite Tags User rated
difficulty
More info /
forum

Bite 1. Sum n numbers

Write a Python function that calculates the sum of a list of (int) numbers: The function should accept a list …

3.10 default args freebie

None range sum
3.62⚬⚬⚬⚬

        0

Bite 5. Parse a list of names

In this Bite you will work with a list of names. 1. Write a function that accepts a list of …

3.10 freebie lambda

list comprehensions min sorting
4.63⚬⚬⚬⚬⚬

        0

Bite 8. Rotate string characters

Write a function that rotates characters in a string in either direction: - If n is positive, move n characters …

3.10 deque slicing

3.59⚬⚬⚬⚬

        0

Bite 15. Enumerate 2 sequences

Iterate over the given names and countries lists, printing them prepending the number of the loop (starting at 1). Here …

3.10 enumerate string formatting

4.85⚬⚬⚬⚬⚬

        0

Bite 16. PyBites date generator

Write a generator that returns every 100th day counting forward from the PYBITES_BORN date. Here is how the generator would work …

3.10 datetime generators

6.42⚬⚬⚬⚬⚬⚬

        0

Bite 19. Write a property

Write a simple Promo class. Its constructor receives two variables: name (which must be a string) and expires (which must …

3.10 datetime properties

4.5⚬⚬⚬⚬

        0

Bite 21. Query a nested data structure

Given the provided cars dictionary: Get all Jeeps Get the first car of every manufacturer. Get all vehicles containing the …

3.10 data structures dictionary comprehensions

list comprehensions sorting
5.33⚬⚬⚬⚬⚬

        0

Bite 26. Dictionary comprehensions are awesome

A dictionary comprehension is like a list comprehension, but it constructs a dict instead of a list. They are convenient …

3.10 dictionary comprehensions 3.14⚬⚬⚬

        0

Bite 29. Martin's IQ test

Martin is preparing to pass an IQ test. The most frequent task in this test is to find out which …

3.10 enumerate string module

4.67⚬⚬⚬⚬⚬

        0

Bite 32. Don't let mutability fool you

In this Bite you are presented with a function that copies the given items data structure. There is a problem …

3.10 deepcopy mutability

1.92⚬⚬

        0

Bite 37. Rewrite a for loop using recursion

Although you have to be careful using recursion it is one of those concepts you want to at least understand. …

3.10 recursion reverse

2.58⚬⚬⚬

        0

Bite 38. Using ElementTree to parse XML

In this Bite you will use ElementTree to parse some Nolan movies we extracted from OMDb. Luckily most APIs switched …

3.10 movie data xml

5.36⚬⚬⚬⚬⚬

        0

Bite 43. Force keyword arguments

Write a function called get_profile that only allows 2 keyword arguments: name and profession which default to julian and programmer …

3.10 function arguments kwargs

4.59⚬⚬⚬⚬⚬

        0

Bite 44. License key generator

Write a function called gen_key that creates a license key with this format: KI80OMZ7-5OGYC1AC-735LDPT1-4L11XU1U The key consists of a combination …

3.10 list comprehensions secrets

string module
3.93⚬⚬⚬⚬

        0

Bite 45. Keep a queue of last n items

How about writing a queue that holds the last 5 items? Queue follows First-In-First-Out methodology, i.e., the data item stored …

3.10 deque 4.11⚬⚬⚬⚬

        0

Bite 46. You are a programmer! Code Fizz Buzz

Here is a beginner Bite to write Fizz Buzz: Fizz buzz is a group word game for children to teach …

3.10 fizzbuzz 1.86⚬⚬

        0

Bite 54. Nicer formatting of a poem or text

In this Bite you complete print_hanging_indents to print a poem (or text) in a nicer way. For example calling it …

3.10 string manipulation textwrap

5.82⚬⚬⚬⚬⚬⚬

        0

Bite 55. Get the latest game releases from Steam's RSS feed

The Steam gaming platform has an RSS feed of their latest game releases. In this Bite, you'll pull down and …

3.10 feedparser namedtuple

3.12⚬⚬⚬

        0

Bite 56. Add a command line interface to our BMI calculator

Complete create_parser below so that our BMI program can be called like this: $ python bmi.py -h usage: bmi.py [-h] …

3.10 argparse 4.15⚬⚬⚬⚬

        0

Bite 64. Fix a truncating zip function

Bert is in charge of organizing an event and got the attendees names, locations and confirmations in 3 lists. Assuming …

3.10 itertools zip

2.61⚬⚬⚬

        0

Bite 66. Calculate the running average of a sequence

Write a function that takes a sequence of items and returns the running average, so for example this: running_mean([1, 2, …

3.10 enumerate itertools

mean
3.5⚬⚬⚬⚬

        0

Bite 67. Working with datetimes

This Bite involves solving two problems using datetime: We kicked off our 100 Days of Code project on March 30th, …

3.10 datetime timedelta

3.16⚬⚬⚬

        0

Bite 68. Remove punctuation characters from a string

Complete remove_punctuation which receives an input string and strips out all punctuation characters (!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~). Return the resulting string. You can …

3.10 string manipulation string module

2.18⚬⚬

        0

Bite 74. What day of the week were you born on?

Complete weekday_of_birth_date which takes a date object of a birthday and returns the corresponding weekday string. For example Bob and …

3.10 calendar 1.82⚬⚬

        0

Bite 77. New places to travel to

You want to find people who have as much exposure to different cultures as yourself. Complete the uncommon_cities helper that …

3.10 set set operations

1.87⚬⚬

        0

Bite 80. Check equality of two lists

In this Bite we compare two list objects for equality, a fundamental thing to understand in Python. Complete the check_equality …

3.10 enum equality

list
3.57⚬⚬⚬⚬

        0

Bite 83. At what time does PyBites live?

Get to know pytz! pytz brings the Olson tz database into Python (docs). Let's see how many hours Bob and …

3.10 pytz timezones

3.11⚬⚬⚬

        0

Bite 91. Matching multiple strings

Catching up after #PyCon2018 ... in this Bite you do multiple string matching. Complete contains_only_vowels, contains_any_py_chars, and contains_digits below. See …

3.10 all any

string matching
3.38⚬⚬⚬

        0

Bite 96. Build Unix' wc program in Python

In this Bite you will convert Unix' wc command into Python. Your function takes a file (absolute path), reads it …

3.10 file processing tempfile

Unix
4.2⚬⚬⚬⚬

        0

Bite 100. Display the last part of a file (Unix tail)

Complete the function below simulating Unix' tail, for example: $ tail -3 test_tail.py # byte to str conversion and strip …

3.10 file processing slicing

strip Unix
2.8⚬⚬⚬

        0

Bite 115. Count leading spaces

A small but interesting Bite: given a string with leading indent spacing, calculate the amount of space (literal space, not …

3.10 counting string matching

2.83⚬⚬⚬

        0

Bite 117. Round a number even (a.k.a. banker's rounding)

Bankers Rounding is an algorithm for rounding quantities to integers, in which numbers which are equidistant from the two nearest …

3.10 Decimal rounding

1.75⚬⚬

        0

Bite 128. Work with datetime's strptime and strftime

In this Bite you get some more practice with datetime's useful strptime and stftime. Complete the two functions: years_ago and …

3.10 datetime strftime

strptime
3.05⚬⚬⚬

        0

Bite 130. Analyze some basic Car Data

In this exercise you will analyze some basic car data. Here is the (fake) JSON data we created with Mockeroo …

3.10 Counter data analysis

list comprehensions set
3.94⚬⚬⚬⚬

        0

Bite 133. Convert an Amazon URL into an affiliation link

Can you help PyBites automate their Amazon affiliation link creation? Complete the generate_affiliation_link(url) function below which should convert the following …

3.10 regular expressions string manipulation

2.53⚬⚬⚬

        0

Bite 136. Bloodtypes

Check red blood cell compatibility between donor and recipient. For simplicity, only eight basic types of blood are considered. The …

3.10 enum exception handling

multi type input
5.92⚬⚬⚬⚬⚬⚬

        0

Bite 143. Look up a value in 3 dictionaries

In this Bite you are presented with 3 dictionaries. Complete get_person_age that takes a name as argument and returns the …

3.10 collections dict

3.36⚬⚬⚬

        0

Bite 149. Sorting words with constraint

Here is a list of words Jacob is trying to sort: >>> words = "It's almost Holidays and PyBites wishes …

3.10 lambda sorting

string manipulation
3.75⚬⚬⚬⚬

        0

Bite 153. Round a sequence of numbers

It's time to get mathematical! In this Bite we ask that you complete the round_up_or_down function that receives a transactions …

3.10 list comprehensions math

rounding
1.38

        0

Bite 161. Count the number of files and directories

Complete count_dirs_and_files traversing the passed in directory path. Return a tuple of (number_of_directories, number_of_files) Let's use the tree command to …

3.10 counting directories

files os module
3.67⚬⚬⚬⚬

        0

Bite 165. Parse an /etc/passwd file output

The /etc/passwd file is a text-based database of information about users that may log into the system or other operating …

3.10 split string manipulation

tuple unpacking
3.64⚬⚬⚬⚬

        0

Bite 167. Complete a User class: properties and representation dunder methods

In this Bite you are presented with another class, User this time. Like last Bite you are asked to complete …

3.10 classes dunder methods

f-strings properties __repr__ __str__ string manipulation
3.87⚬⚬⚬⚬

        0

Bite 169. Simple length converter

Your task is to complete the convert() function. It's purpose is to convert centimeters to inches and vice versa. As …

3.10 exception handling numbers

rounding
2.56⚬⚬⚬

        0

Bite 172. Having fun with Python Partials

Meet another gem in the standard library: functools, which contains tools for functional-style programming. In this Bite you will play …

3.10 functools partial

rounding
2.09⚬⚬

        0

Bite 176. Create a variable length chessboard

In this Bite you are going to print a chessboard to stdout (use print). Complete create_chessboard that takes an optional …

3.10 modulo range

stdout
2.0⚬⚬

        0

Bite 180. Group names by country

In this Bite you are presented with a list of surnames, names, and countries. These 3 fields are in a …

3.10 collections defaultdict

groupby
4.23⚬⚬⚬⚬

        0

Bite 181. Keep a list sorted upon insert

Complete the add method of the OrderedList class which takes a num argument and adds that to the self._numbers list …

3.10 bisect classes

data structures __str__
2.08⚬⚬

        0

Bite 188. Get statistics from PyBites test code

Did you know Python has a statistics module? For this Bite we did a line count on our test code …

3.10 data analysis file processing

statistics
2.9⚬⚬⚬

        0

Bite 189. Filter a list of names

Here is a Bite to practice the continue and break statements in Python. Complete filter_names that takes a list of …

3.10 break continue

generators looping
2.14⚬⚬

        0

Bite 192. Some logging practice

You are to flesh out the log_it() function so that it will log to any LOG LEVEL and with any …

3.10 callable logging

5.25⚬⚬⚬⚬⚬

        0

Bite 208. Find the number pairs summing up N

In this Bite you complete find_number_pairs which receives a list of numbers and returns all the pairs that sum up …

3.10 itertools looping

numbers
2.18⚬⚬

        0

Bite 209. Write a Sphinx docstring

Your team uses Sphinx and wants you to comply with its standards for docstrings. As per the Sphinx-RTD-Tutorial a typical …

3.10 data types docstring

sphinx
1.5⚬⚬

        0

Bite 210. Add Type Annotations

Continuing from where we left off in Bite 209, use the docstring you wrote in last Bite to add type …

3.10 annotations type hinting

typing
2.83⚬⚬⚬

        0

Bite 214. A countdown generator

Write a simple generator that counts from 100 to 1. It can just return the ints one by one, no …

3.10 generators 1.91⚬⚬

        0

Bite 215. Validate a license key

Complete the validate_license function writing a regular expression that matches a PyBites license key which: Starts with PB, following 4 …

3.10 bool regular expressions

4.27⚬⚬⚬⚬

        0

Bite 218. Create a sandwich decorator

After creating our Decorators and Context Managers learning path we realized we did not have a beginner decorator Bite, so …

3.10 decorators 3.31⚬⚬⚬

        0

Bite 225. Swap case PyBites characters

In this Bite you will swap case all pybites characters (both lower- and upper case) for a given text. Not …

3.10 looping string manipulation

string parsing
2.89⚬⚬⚬

        0

Bite 231. Where are the emojis?

In this Bite you are given a list of strings that contain emojis. Complete get_emoji_indices returning a list of indices …

3.10 emojis list

list comprehensions looping regular expressions
3.22⚬⚬⚬

        0

Bite 238. Write tests for Fibonacci

Our first Test Bite! The concept is simple: to pass a Test Bite, you write tests for the program under …

3.7 fibonacci freebie

pytest
3.15⚬⚬⚬

        0

Bite 241. Write tests for list_to_decimal

Our 4th test Bite. Michael made a calculator that will be able to accept a list of decimal digits and …

3.7 exception handling freebie

pytest
5.0⚬⚬⚬⚬⚬

        0

Bite 246. Test print / standard output

In this Bite you test a function that prints to stdout. Check out pytest's Capturing of the stdout/stderr output how …

3.7 capfd capsys

list comprehensions pytest stdout
3.78⚬⚬⚬⚬

        0

Bite 251. Introducing Pandas Series

Let's get started with Pandas! In case you are not aware of who, or what, pandas is, pandas is an …

3.10 pandas series

string module
2.73⚬⚬⚬

        0

Bite 252. Let's play with Pandas Series

In Bite 251 we looked at creating some simple pandas Series. In this Bite we continue where we left off …

3.10 numpy pandas

series slicing type hinting
3.3⚬⚬⚬

        0

Bite 254. Global vs local variables

This Bite is to illustrate scoping. You will sum numbers while keeping track of number of hundreds in a global …

3.10 global sum

3.25⚬⚬⚬

        0

Bite 257. Extract users dict from a multiline string

A quick Bite to practice some string parsing extracting a users dict from a password file. Complete get_users is how …

3.10 dict string parsing

3.57⚬⚬⚬⚬

        0

Bite 262. GC content

The DNA of all organsims consists of the letters (bases) A, C, T and G. Every organism has a different …

3.10 bioinformatics collections

2.44⚬⚬

        0

Bite 270. Most frequent digit in number

Given an integer number, find the most frequent digit in it. Examples: 1998 -> two 9's, one 1, one 8 …

3.10 Counter counting

numbers
3.0⚬⚬⚬

        0

Bite 278. Major and minor numbers

You are given a list of integers. Write code to find the majority and minorty numbers in that list. Definition: …

3.10 collections max

min numbers
2.56⚬⚬⚬

        0

Bite 279. Armstrong numbers

In number theory there are many interesting numbers - eg. Armstrong numbers, Happy numbers, Meertens numbers, just to name a …

3.10 algorithms numbers

3.29⚬⚬⚬

        0

Bite 283. Like there's no tomorrow?

Ever have difficulty remembering what today's date is? How about tomorrow's? I know I do...  Help me out by completing …

3.10 datetime 4.0⚬⚬⚬⚬

        0

Bite 288. Smallest number

Write a function that accepts a list of digits and returns the smallest number that can be created by combining …

3.10 numbers 3.0⚬⚬⚬

        0

Bite 289. Round to next number

Write a function that accepts a number and a multiple, then rounds the number towards the next multiple. Examples:   Number …

3.10 math 3.2⚬⚬⚬

        0

Bite 293. N digit numbers

Write a function that accepts a list of numbers and converts them into n digit integers. Examples:   n_digit_numbers([1, 2, 3], 2)  …

3.10 numbers 6.33⚬⚬⚬⚬⚬⚬

        0

Bite 295. Join lists

Write a function that accepts a list of lists and joins them with a separator character, therefore flattening and separating.   …

3.10 iteration joining

list
4.0⚬⚬⚬⚬

        0

Bite 314. Print names to columns

In this Bite you will use the modulo operation. You are presented with a function signature that receives a list …

3.10 f-strings modulo

print
3.67⚬⚬⚬⚬

        0

Bite 317. Pickling objects

In this Bite you will load (deserialize) and dump (serialize) a data structure from / to a pickle file which …

3.10 data wrangling pickle

serialization
2.5⚬⚬

        0

Bite 318. Decode base64 encoded data

In this Bite you are going to decode some Base64 encoded csv data. This is what the encoded data looks …

3.10 base64 decode

encode
3.0⚬⚬⚬

        0

Bite 319. Identity and equality

Identity and equality are two important concepts in Python. Please correct the mistakes in the Car class (marked with # …

3.10 equality integer caching

staticmethod
3.33⚬⚬⚬

        0

Bite 322. Reading progress

Happy New Year! How many books do you aim to read this year? In this Bite you will complete ontrack_reading …

3.10 datetime numbers

3.25⚬⚬⚬

        0

Bite 323. Iterables intersection

In this bite we are going to work on coding a function intersection() that searches the common elements across its …

3.10 functools set operations

4.25⚬⚬⚬⚬

        0

Bite 324. Pretty string

Write a function that returns a neatly formatted string representation of a python object. As you might have guessed, there …

3.10 pprint 2.0⚬⚬

        0

Bite 336. FastAPI Hello World

Welcome to this FastAPI learning path. In the next 10 Bites you will write a simple API to track food …

3.10 FastAPI freebie

4.75⚬⚬⚬⚬⚬

        0

Bite 337. A little detour: Pydantic

Pydantic is an awesome library to do data validation and settings management using python type annotations. FastAPI is a heavy …

3.10 FastAPI freebie

Pydantic
4.75⚬⚬⚬⚬⚬

        0

Bite 347. Which words can you type with one hand?

In this Bite you will write a function that takes a word and determines if it can be written with …

3.10 comparison enum

set
1.0

        0

Bite 353. Transform a Script Into a Command Line Interface (CLI)

There are several Python frameworks to create CLIs, check out this overview of CLI framework options.  In this Bite we …

3.10 command line Typer

5.0⚬⚬⚬⚬⚬

        0

Bite 355. Create Your First Typer Command Line Interface (CLI) Application

In the previous Bites, you have successfully transformed an existing script into a CLI using typer.run(). In this Bite, you …

3.10 command line Typer

        0

Bite 357. Implement your First Subcommands and Command Groups

In the previous Bite, you learned how to create an application and added several commands for that app. Now, let's …

3.10 command line Typer

        0

Bite 360. Add a progress bar to Your Command Line Interface (CLI)

In this Bite, you will create a simplistic CLI application with a simple progress bar. Refer to the progress bar …

3.10 command line rich

Typer

        0

Bite 371. Python3.9 - Dictionary Merge

Python 3.9 brought an exciting enhancement to the dict built-in class! Dictionaries can now be merged with the | operator …

dict Python3.9 union

5.0⚬⚬⚬⚬⚬

        0

Bite 372. Validate Pangram

A pangram, according to the Oxford English Dictionary, is a sentence or verse that contains all of the letters of …

algorithms hashing string

strings
3.0⚬⚬⚬

        0

Bite 373. Reverse only Letters

Given a string, reverse only the English letters (lowercase or uppercase) in the string, leaving all non-English letters and other …

queues stacks strings

6.0⚬⚬⚬⚬⚬⚬

        0


Bite Tags User rated
difficulty
More info /
forum

Bite 3. Word Values

Find the dictionary word with the highest value using Scrabble rules. There are three tasks to complete for this Bite: Finish …

3.10 freebie max

Scrabble sum
3.83⚬⚬⚬⚬

        0

Bite 4. Top 10 PyBites tags

In this Bite you will find the top ten tags found in the PyBites blog XML feed (e.g. Python, Flask, Django, …

3.10 Counter xml

4.81⚬⚬⚬⚬⚬

        0

Bite 6. PyBites Die Hard

Given a listing of files for our community branch, determine: - Who opened the most pull requests (excluding PyBites)? - …

3.10 Counter file processing

generators namedtuple
5.44⚬⚬⚬⚬⚬

        0

Bite 7. Parsing dates from logs

In this Bite we will look at this short server log, finding the first and last system shutdown events: INFO 2014-07-03T23:27:51 …

3.10 datetime file processing

5.72⚬⚬⚬⚬⚬⚬

        0

Bite 9. Palindromes

Write a function to determine if a word or phrase is a palindrome. Then write a second function to receive …

3.10 algorithms list comprehensions

max reverse
4.35⚬⚬⚬⚬

        0

Bite 10. Practice exceptions

In this Bite you'll learn to catch and raise Python exceptions. Write a simple division function meeting the following requirements: …

3.10 exception handling raise

2.92⚬⚬⚬

        0

Bite 12. Write a user validation function

Create a function that takes a username and checks for a valid user: 1. The username is in USERS 2. The …

3.10 classes exception handling

namedtuple
4.43⚬⚬⚬⚬

        0

Bite 13. Convert dict to namedtuple/json

Write a function to convert the given blog dict to a namedtuple Write a second function to convert the resulting …

3.10 dict json

namedtuple
3.64⚬⚬⚬⚬

        0

Bite 14. Generate a table of n sequences

Write a function that receives one or more sequences. The sequences are already defined for you. The function should return …

3.10 generators zip

5.0⚬⚬⚬⚬⚬

        0

Bite 17. Form teams from a group of friends

Write a function called friends_teams that takes a list of friends, a team_size (type int, default=2) and order_does_matter (type bool, …

3.10 itertools 3.55⚬⚬⚬⚬

        0

Bite 18. Find the most common word

Write a function that returns the most common (non stop)word in this Harry Potter text. Make sure you convert to …

3.10 Counter data analysis

list comprehensions
5.1⚬⚬⚬⚬⚬

        0

Bite 22. Write a decorator with argument

Write a decorator called make_html that wraps text inside one or more html tags. As shown in the tests decorating …

3.10 decorators 5.68⚬⚬⚬⚬⚬⚬

        0

Bite 25. No promo twice, keep state in a class

In this bite a real world scenario: PyBites has a growing set of Bites and gives away promos. They choose …

3.10 classes exception handling

properties
5.58⚬⚬⚬⚬⚬⚬

        0

Bite 27. Parse omdb movie json data

Working with APIs is very common these days and lucky for us they increasingly return JSON (over XML). We saved …

3.10 APIs glob

json movie data
4.57⚬⚬⚬⚬⚬

        0

Bite 28. Converting date strings to datetimes

In this Bite you are provided with a list of publish dates of all our PyBites blog posts. They are …

3.10 Counter datetime

findall
4.09⚬⚬⚬⚬

        0

Bite 30. Movie data analysis

In this Bite we are going to parse a csv movie dataset to identify the directors with the highest rated …

3.10 data analysis defaultdict

freebie mean movie data namedtuple sorting
5.86⚬⚬⚬⚬⚬⚬

        0

Bite 33. Transpose a data structure

Sometimes you need to restructure a nested data structure. For example you can convert a dict in a list of …

3.10 dict zip

4.6⚬⚬⚬⚬⚬

        0

Bite 35. Having fun with heapq

In this Bite you are provided with 3 data structures: a list of ints, a list of datetimes, and a …

3.10 datetime heapq

2.82⚬⚬⚬

        0

Bite 36. Having fun with *args and **kwargs

Write a function called get_profile that takes: a required name, a required age, one or more optional sports (args), one …

3.10 args function arguments

kwargs
2.56⚬⚬⚬

        0

Bite 39. Calculate the total duration of a course

In this Bite you read in a text file with course times (MM:SS) per video. You extract these and calculate …

3.10 datetime findall

numbers timedelta
4.3⚬⚬⚬⚬

        0

Bite 41. Write a login_required decorator

If you worked with Flask or Django you must have seen routes being decorated to enforce authentication. In this Bite …

3.10 decorators functools

3.71⚬⚬⚬⚬

        0

Bite 47. Write a new password field validator

You know these Create a new password forms? They do a lot of checks to make sure you make a …

3.10 re string module

3.55⚬⚬⚬⚬

        0

Bite 48. Make a bar chart of new Safari books

Some time ago we made a little Slack bot to post new titles added to Safari to Slack. And luckily …

3.10 bar chart data analysis

5.09⚬⚬⚬⚬⚬

        0

Bite 49. Scrape Packt's html with BeautifulSoup

In this Bite you will parse Packt's free learning ebook site extracting the html for the daily free ebook: As …

3.10 beautifulsoup namedtuple

requests
5.25⚬⚬⚬⚬⚬

        0

Bite 51. When does Python 2 die on Planet Miller?

Imagine you landed on Planet Miller (from the movie Interstellar) where 1 hour takes 7 Earth years (known as the …

3.10 datetime 3.5⚬⚬⚬⚬

        0

Bite 57. Create a simple calculator that receives command line arguments

In this Bite you write a simple calculator that can perform additions (add), subtractions (sub), multiplications (mul) and divisions (div). …

3.10 argparse functools

reduce
6.56⚬⚬⚬⚬⚬⚬⚬

        0

Bite 59. Create a multiplication table class of variable length

Danny does not like rote learning (nor do we!). He is asked to remember multiplication tables of considerable size 😭 …

3.10 classes dunder methods

exception handling numbers
4.33⚬⚬⚬⚬

        0

Bite 60. Create a deck of Uno cards

In this Bite you will create a deck of Uno cards. Here is the equipment requirement as described here - …

3.10 list list comprehensions

namedtuple
3.6⚬⚬⚬⚬

        0

Bite 62. Data structures matter - speed up your Python code

In this Bite we provide you with 5 functions which you have to try to make faster. Some require different …

3.10 data structures performance

4.0⚬⚬⚬⚬

        0

Bite 65. Get all valid dictionary words for a draw of letters

This Bite focusses on the use of itertools. To that extend you complete get_possible_dict_words and _get_permutations_draw to get all valid …

3.10 itertools Scrabble

set
6.65⚬⚬⚬⚬⚬⚬⚬

        0

Bite 70. Create your own iterator

In this Bite you make an iterator called EggCreator by implementing the __iter__ and __next__ dunder methods (as dictated by …

iterators random 3.43⚬⚬⚬

        0

Bite 71. Keep state in a class + make its instance callable

In this Bite you write a small class to keep track of the max score in a game. When called …

3.10 classes dunder methods

2.67⚬⚬⚬

        0

Bite 72. Retrieve the right Ninja Belt based on score

As you have probably seen on the dashboard you can now gain Ninja Belts based on the amount of points …

3.10 itertools OrderedDict

4.2⚬⚬⚬⚬

        0

Bite 73. Organize a meeting between timezones (pytz)

Help PyBites community friends find a reasonable common time to meet! Complete the function below receiving a UTC datetime and …

3.10 pytz timezones

5.88⚬⚬⚬⚬⚬⚬

        0

Bite 78. Find programmers with common languages

Similar as last Bite we do another comparison of sequences exercise. Here is the deal: you are in charge of …

3.10 set set operations

2.89⚬⚬⚬

        0

Bite 79. Parse a csv file and create a bar chart

We played a bit with the Slack API today and wow: our PyBites community is super international! We really enjoy …

3.10 bar chart community

csv requests
5.0⚬⚬⚬⚬⚬

        0

Bite 81. Filter and order tweets by polarity values

In this Bite we collected some random tweets and populated a list of namedtuples of text and a polarity rating …

3.10 namedtuple TextBlob

Twitter
2.67⚬⚬⚬

        0

Bite 82. Define a Score Enum and customize it adding methods

Starting Python 3.4 there is support for enumerations (not to confuse with the enumerate builtin). You can define a class …

3.10 classmethod enum

__str__
3.17⚬⚬⚬

        0

Bite 84. Flatten lists recursively (Droste Bite)

Complete flatten that takes a list of lists (which can have lists ad infinitum) and flatten them into a one …

3.10 list recursion

4.38⚬⚬⚬⚬

        0

Bite 86. Create a RGB-to-Hex converter

Designer Mary wants to convert her CSS from statements like background-color: rgb(128, 128, 0); to: background-color: #808000;. Don't worry, you …

3.10 string formatting 2.75⚬⚬⚬

        0

Bite 87. Convert Decimal to Roman Numerals

Complete romanize that takes a decimal number and converts it to its Roman Numeral equivalent. If a non int or …

3.10 numbers OrderedDict

3.83⚬⚬⚬⚬

        0

Bite 89. Playing with lists and dicts

In this Bite you are presented with a us_state_abbrev dict and a states list. Complete the four methods in the …

3.10 data structures dict

list
3.54⚬⚬⚬⚬

        0

Bite 90. What South Park characters talk most?

Did we already tell you we love the collections module? In this Bite we combine its defaultdict and Counter data …

3.10 Counter csv

data analysis defaultdict requests
8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 92. Humanize a datetime

In this Bite you will convert a timedelta object into something readable. We know: there are modules to do it, …

3.10 datetime namedtuple

5.44⚬⚬⚬⚬⚬

        0

Bite 95. Subclass the dict built-in

In this Bite you will subclass the dict built-in to support a birthday dictionary. This dictionary takes names as keys …

3.10 classes inheritance

4.5⚬⚬⚬⚬

        0

Bite 97. BeautifulSoup II - scrape US holidays

In this Bite we use BeautifulSoup to scrape US holidays from OfficeHolidays to make a lookup of holidays per month. …

3.10 beautifulsoup defaultdict

dict
4.94⚬⚬⚬⚬⚬

        0

Bite 99. Write an infinite sequence generator

Write a generator that produces the sequence [1, 'A', 2, 'B', 3, 'C', ... 'X', 25, 'Y', 26, 'Z'] infinitely. …

3.10 generators itertools

string module zip
3.67⚬⚬⚬⚬

        0

Bite 111. Use the ipinfo API to lookup IP country

In this Bite you will use the requests library to make a GET request to the ipinfo service. Use IPINFO_URL …

3.10 APIs json

mock.patch requests
1.9⚬⚬

        0

Bite 113. Filter words with non-ascii characters

In this Bite you extract words from a text that contain non-ascii characters. So Fichier non trouvé would return a …

3.10 all ascii

ord unicode
2.78⚬⚬⚬

        0

Bite 114. Implement a Color class with staticmethod

As the new junior developer, you have been charged with enhancing the Color class. Your task will be to implement …

3.10 hex __repr__

staticmethod __str__ string module
6.33⚬⚬⚬⚬⚬⚬

        0

Bite 116. List and filter files in a directory

In this Bite you complete get_files that receives a dirname and size_in_kb (note kb, not bytes). There are two things …

3.10 generators glob

os module
3.0⚬⚬⚬

        0

Bite 118. List exercise: return first occurrence indices of duplicated words

In this Bite you are presented with a list of words. Loop through them and find all the words that …

3.10 counting list comprehensions

set
2.3⚬⚬

        0

Bite 119. Xmas tree generator

In this Bite you complete generate_xmas_tree that takes a rows arg (= height of the tree). For each row you …

3.10 default args join

range string formatting
2.17⚬⚬

        0

Bite 120. Write a numbers validation decorator

Let's get some more practice with decorators ... in this Bite you will write a decorator that checks if input …

3.10 decorators 3.0⚬⚬⚬

        0

Bite 122. Check if two words are anagrams

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using …

3.10 anagram string matching

2.5⚬⚬

        0

Bite 123. Find the user with most friends

In this Bite you are presented with a users dict of keys=id's and values=usernames and a friendships list of user …

3.10 defaultdict looping

sorting tuples
4.67⚬⚬⚬⚬⚬

        0

Bite 125. Get the most recommended books

The Tim Ferriss Show is full of wisdom and inspiration. It can also quickly fill up your book shelves because …

3.10 beautifulsoup Counter

default args list comprehensions requests
5.85⚬⚬⚬⚬⚬⚬

        0

Bite 127. Return the right ordinal suffix for a number

In this Bite you complete a function that takes an int and returns it appended with the right suffix: 1 …

3.10 dict modulo

numbers string manipulation
2.0⚬⚬

        0

Bite 129. Analyze Stock Data

In this Bite we will answer some questions about stocks, using some JSON data obtained from the awesome Mockeroo fake …

3.10 counting data analysis

json requests sorting string manipulation
4.25⚬⚬⚬⚬

        0

Bite 132. Find the word with the most vowels

Finish the get_word_max_vowels function below that takes a text string as its input argument and returns a tuple of the …

3.10 counting lambda

list comprehensions string matching
2.43⚬⚬

        0

Bite 135. Sort a list of book objects

In this Bite you are going to look at a list of Book namedtuples and sort them by various criteria. …

3.10 attrgetter datetime

lambda list namedtuple operator sorting
2.12⚬⚬

        0

Bite 137. Gourmets' Nightmare

Many gourmets struggle to find the perfect pairing of wines and cheeses. A number of considerations are relevant, each of …

3.10 Counter intersection

operator sorting
7.5⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 138. OOP fun at the Zoo

Finish the Animal class below adding one or more class variables and a classmethod so that the following code: dog …

3.10 classes classmethod

itertools __str__
5.15⚬⚬⚬⚬⚬

        0

Bite 140. PyBites First Pandas Bite

This is a Pandas proof-of-concept Bite. We just added the library to our platform! For this Bite you find out …

3.10 csv data analysis

pandas
5.75⚬⚬⚬⚬⚬⚬

        0

Bite 141. Primitive date format inferrer

Complete the get_dates method given the following: a listing of date strings in unknown date format and an enum class …

3.10 classmethod datetime

enum exception handling
6.67⚬⚬⚬⚬⚬⚬⚬

        0

Bite 142. Exception Handling: Calculate the Winning Player

Complete the two functions below: calculate_score takes a list of dice roll scores and returns the total score only taking …

3.10 exception handling namedtuple

numbers
1.67⚬⚬

        0

Bite 144. Calculate the Number of Months Passed

Some more fun working with dates! In this Bite you will calculate the number of months between the fixed START_DATE …

3.10 datetime dateutil

exception handling
3.86⚬⚬⚬⚬

        0

Bite 146. Rhombus generator

In this Bite you make a generator of rhombus shapes. You will complete gen_rhombus that when called like this: gen …

3.10 format f-strings

string formatting
1.86⚬⚬

        0

Bite 147. 100 WEEKDays of Code Date Range

Doing a #100DaysOfCode can be challenging, and some of it is because you dedicate to do it on workdays AND …

3.10 datetime dateutil

3.86⚬⚬⚬⚬

        0

Bite 148. Print Car Data Grouped by Manufacturer

In this Bite you are presented with a list of car (manufacturer, model) tuples. Group the data by manufacturer printing …

3.10 data structures itertools

operator sorting
2.8⚬⚬⚬

        0

Bite 150. Turn messy CSV into JSON

At the 1 year mark of our platform here is Bite 150! In this Bite you are presented with some …

3.10 csv json

pandas re string manipulation
4.88⚬⚬⚬⚬⚬

        0

Bite 151. Contemporary Composers

You are given a list of operas and a list of composers. For two given composers find operas (where one …

3.10 datetime dict

exception handling generators namedtuple
4.38⚬⚬⚬⚬

        0

Bite 154. Write your own Data Class

As you might have noticed we are now on Python 3.7 so time for a Bite on data classes which …

3.10 dataclasses data structures

hashable sorting type hinting
3.1⚬⚬⚬

        0

Bite 155. Split a string by spaces or quoted text

Another text manipulation Bite. Code split_words_and_quoted_text that takes a text string and splits it by space, except words that are …

3.10 split string manipulation

4.22⚬⚬⚬⚬

        0

Bite 156. Make an index of story characters

You know the index at the end of a book where you look up which pages people and terms occur? …

3.10 collections defaultdict

enumerate sorting string matching
5.64⚬⚬⚬⚬⚬⚬

        0

Bite 157. Filter out accented characters

Another unicode Bite. Given some non-English text with accents (á, é, í, used in Spanish for example), extract the accented …

3.10 string matching unicode

3.25⚬⚬⚬

        0

Bite 159. Create a simple calculator

In this Bite you will create a simple calculator. It takes a string of num1 operator num2 which you convert …

3.10 exception handling numbers

operator
2.57⚬⚬⚬

        0

Bite 162. Vertically align output of counters

In this Bite you are tasked with "physically" aligning the number of comments on a webpage. For some reason you …

3.10 string formatting 1.89⚬⚬

        0

Bite 163. Which packages were upgraded?

In this Bite you compare a list of packages (aka requirement.txt) from before vs. after (pip) upgrade. Check the TESTS …

3.10 comparison dict

numbers string manipulation
3.71⚬⚬⚬⚬

        0

Bite 166. Complete a tox ini file parser class

The INI file format is an informal standard for configuration files for some platforms or software. (Wikipedia). In this Bite …

3.10 classes configparser

properties string matching string parsing tox
6.31⚬⚬⚬⚬⚬⚬

        0

Bite 173. Set up future notifications

Let's do another datetime processing Bite. Complete add_todo below that converts time units to future timestamps. Here is how it …

3.10 datetime findall

f-strings timedelta
4.83⚬⚬⚬⚬⚬

        0

Bite 175. Find missing dates

Complete get_misssing_dates that takes an (unordered) sequence of datetime.date objects. It should determine what the start and end date of …

3.10 datetime dateutil

pandas
3.0⚬⚬⚬

        0

Bite 178. Parse PyBites blog git commit log

In this Bite we want to figure out how active we've been on our blog. To start our data analysis …

3.10 Counter data analysis

datetime dateutil string parsing
5.75⚬⚬⚬⚬⚬⚬

        0

Bite 182. Parse a bunch of quotes from HTML

Let's get some inspiration. Below you find the simplified HTML of Richard Branson's My top 10 quotes on living life …

3.10 dict regular expressions

string manipulation string parsing
3.62⚬⚬⚬⚬

        0

Bite 184. Analyze some Bite stats data

In this Bite we will look at some Bite stats logs (usernames have been anonymized!): $ head -5 bite_output_log.txt bite,user,completed …

3.10 Counter csv

data analysis set
4.0⚬⚬⚬⚬

        0

Bite 185. Create a simple spelling suggester

In this Bite you will write a simple spelling corrector. Complete suggest_word that receives a misspelled word argument and returns …

3.10 difflib SequenceMatcher

string matching
3.12⚬⚬⚬

        0

Bite 186. Calculate number of books to have read at date ...

For this Bite you are asked to start working on a reading goal feature for PyBites My Reading List. Code …

3.10 datetime dateutil

exception handling
4.0⚬⚬⚬⚬

        0

Bite 187. Actor/actress age at movie release

Ever wondered how old an actor/actress was in a particular movie? In this Bite you will write some code to …

3.10 dataclasses dateutil

f-strings
2.75⚬⚬⚬

        0

Bite 190. Parse income distribution from Latin America XML

In this Bite you are going to parse some Latin American countries in xml, specifically the output of api.worldbank.org/V2/country?region=LCN which …

3.10 data analysis defaultdict

xml
5.0⚬⚬⚬⚬⚬

        0

Bite 191. Starwars character with highest BMI

In this Bite you will parse a multiline string of SWAPI Starwars characters. Calculate the BMI of each character returning …

3.10 max operator

string manipulation tuple unpacking
1.78⚬⚬

        0

Bite 193. Most upvoted StackOverflow Python questions

In this Bite you parse a copy of StackOverflow Python questions which we cached here Retrieve + parse this URL …

3.10 beautifulsoup requests

sorting string matching web scraping
5.4⚬⚬⚬⚬⚬

        0

Bite 194. Add caching to a Fibonacci function

In this Bite you will learn about memoization: In computing, memoization or memoisation is an optimization technique used primarily to …

3.10 cache fibonacci

functools performance
2.75⚬⚬⚬

        0

Bite 195. Analyze NBA Data with sqlite3

In this Bite you are going to use sqlite3! We loaded some NBA data into a players DB table: Complete …

3.10 data analysis databases

SQL sqlite3
5.0⚬⚬⚬⚬⚬

        0

Bite 197. What date is Mother's Day celebrated?

It's the 12th of May 2019 when we write this so happy Mother's Day! In many countries this special day …

3.10 datetime dateutil

2.0⚬⚬

        0

Bite 199. Multiple inheritance (__mro__)

Implement the following class structure: print(Child.__mro__): (<class '__main__.Child'>, <class '__main__.Father'>, <class '__main__.Mother'>, <class '__main__.Person'>, <class 'object'>) Each class has the …

3.10 classes inheritance

__mro__ multiple inheritance
2.27⚬⚬

        0

Bite 201. Call a Cisco Nexus 9k device

Cisco Nexus 9k devices is one of the first network equipment with comprehensive API programmatic access from Cisco. API capabilities …

3.10 networking requests

9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 202. Analyze some Bite stats data - part II

In this Bite you will analyze complexity levels of our first 200 Bites of Py exercises. We loaded this CSV …

3.10 csv data analysis

sorting
4.0⚬⚬⚬⚬

        0

Bite 203. Type hinting practice

It's time for some type hinting! For this bite, you have been provided a very simple Employee class object. I …

3.10 classes dataclasses

type hinting
1.88⚬⚬

        0

Bite 205. Female speakers @ Pycon US

After our Code Challenge 62 / Alicante PyDay last week, we thought it would be nice to branch off a …

3.10 beautifulsoup counting

data wrangling gender_guesser
4.3⚬⚬⚬⚬

        0

Bite 206. Calculate and evenly split the bill

Three old friends Bob, Mary, and Alice meet at PyCon and decide to go out to dinner together. They have …

3.10 Decimal numbers

rounding
7.64⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 212. Suppressing exceptions

Ever wanted to suppress an exception? Check out Python's contextlib module. In this Bite you refactor sum_numbers which has some …

3.10 context managers exception handling

2.82⚬⚬⚬

        0

Bite 217. Capture stdout

Sometimes you need to capture stdout in your script. Python makes it easy with contextlib's redirect_stdout. In this Bite you …

3.10 context managers StringIO

3.43⚬⚬⚬

        0

Bite 219. Bite notification planner

Another real world use case. When we added notifications to our learning paths, we gave the user the option to …

3.10 datetime generators

3.17⚬⚬⚬

        0

Bite 221. Parse best selling lists using the NY Times API

In this Bite you are going to parse NY Times Best Seller Lists using The New York Times Developer Network. …

3.10 APIs json

mock requests
4.71⚬⚬⚬⚬⚬

        0

Bite 222. Split an iterable in groups of size n

In this Bite you will complete the group function that receives an iterable and splits it up in n groups. …

3.10 generators iterators

itertools looping
3.0⚬⚬⚬

        0

Bite 223. Unix file permissions

Each file and directory in Unix has its permissions broken down into owner, group and other (world) attributes, see here. …

3.10 dict list comprehensions

string manipulation
2.33⚬⚬

        0

Bite 226. Get top titles from news.python.sc

There is a new Python news aggregator in town! Check it out here. In this Bite you will parse it! …

3.10 beautifulsoup namedtuple

news requests sorting string parsing web scraping
4.89⚬⚬⚬⚬⚬

        0

Bite 227. Convert Warcraft json data to csv

In this Bite we are going to convert some Warcraft Mount JSON data to csv. Here are the steps to …

3.10 csv exception handling

json
5.6⚬⚬⚬⚬⚬⚬

        0

Bite 228. Create a Gravatar URL

In this Bite you will generate a Gravatar URL, e.g. https://www.gravatar.com/avatar/5b13356d467af88631503c27a3d0e0cf?s=200&r=g&d=robohash. In this URL 5b13356d467af88631503c27a3d0e0cf is a hash of a …

3.10 gravatar hashlib

string formatting
2.8⚬⚬⚬

        0

Bite 230. Thumbs up for operator overloading

In this Bite we learn a bit of operator overloading. Finish the Thumbs class that returns an amount of thumbs …

3.10 classes dunder methods

emojis exception handling operator overloading
3.14⚬⚬⚬

        0

Bite 232. Analyze gold prices

In this Bite you will analyze how the price of gold evolved over the years 1950-2018. We loaded the gold …

3.10 comparison data analysis

looping pandas sorting string parsing
3.86⚬⚬⚬⚬

        0

Bite 233. Make a zipfile of the latest log files

You added some monitoring the other day writing log files to a directory. In this Bite you will zip up …

3.10 datetime os module

pathlib zipfile
5.17⚬⚬⚬⚬⚬

        0

Bite 234. Capitalize sentences

In this Bite you are going to capitalize sentences in a block of lowercased text. Correct grammar dictates that each …

3.10 regular expressions string manipulation

string matching string parsing
3.86⚬⚬⚬⚬

        0

Bite 235. Which Bite has the fastest tests?

In this Bite you will parse a pytest output summary, calculating the Bite that has the fastest average tests. Log …

3.10 sorting string parsing

type casting
5.44⚬⚬⚬⚬⚬

        0

Bite 236. User experience matters! Suggest matching files

We love it when CLI or web apps take the extra mile to be more user friendly. In this Bite …

3.10 difflib files

pathlib
4.17⚬⚬⚬⚬

        0

Bite 239. Test FizzBuzz

In our second Test Bite you will write tests for FizzBuzz. Refer to the "Code to Test" tab, then start …

3.7 fizzbuzz pytest

3.1⚬⚬⚬

        0

Bite 243. Test code that parses JSON and IP ranges

Another Test Bite, we ❤️them 😁- today you will write tests for IPv4Network (ipaddress module) and dataclass objects 💪. Check …

3.7 dataclasses ipaddress

json pytest
5.57⚬⚬⚬⚬⚬⚬

        0

Bite 244. Make mutpy's output more digestible

Another real world scenario. When we started using MutPy for our test Bites, we quickly learned that the verbose output …

3.10 data wrangling looping

mutpy string matching string parsing
4.14⚬⚬⚬⚬

        0

Bite 245. Xmas Tree 2.0

In this Bite you have to complete generate_improved_xmas_tree that takes a rows arg (= number of rows with leafs). For …

3.10 range string formatting

3.0⚬⚬⚬

        0

Bite 247. Mocking a standard library function

In this Bite you will mock out a function of the standard library, more specifically random.sample. We wrote a small …

3.7 mock.patch pytest

random
7.7⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 253. More Pandas Series Practice

In Bite 251 and Bite 252 we looked at creating some simple pandas Series and then we looked at how …

3.10 math pandas

series statistics
5.8⚬⚬⚬⚬⚬⚬

        0

Bite 255. Codon Usage

The genetic code of all organisms uses a 3 base (codon), 4 letter encoding (A, G, C or T/U) to …

3.10 bioinformatics collections

textwrap
7.22⚬⚬⚬⚬⚬⚬⚬

        0

Bite 256. Scrape PyCon events

In this Bite, we want you to scrape PyCon 2019 data. The provided source via _get_pycon_data contains data for years …

3.10 beautifulsoup data analysis

json namedtuple pycon requests web scraping
5.0⚬⚬⚬⚬⚬

        0

Bite 258. What the flux?

One of the benefits of accounting is being able to see the financial position of a company at a point …

3.10 finance math

pandas
3.8⚬⚬⚬⚬

        0

Bite 259. Reverse complement

In the majority of organisms, the genetic code is encoded in a double helical DNA with each of both strands …

3.10 bioinformatics string manipulation

translate
4.25⚬⚬⚬⚬

        0

Bite 261. Visit all PyCons in Europe

In Bite 256 you scraped data on 2019 PyCons. Now it's time to go there! In this Bite you enrich …

3.10 data analysis dataclasses

itertools math
4.8⚬⚬⚬⚬⚬

        0

Bite 263. Count the number of islands in a grid

You are tasked with counting the amount of islands in a 2D matrix / grid. Islands are represented by 1s, …

3.10 algorithms looping

string
7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 264. Clamy Fernet

In this bite, you are going to get familiar with symmetrical encryption using the cryptography module and its Fernet class. …

3.8 cryptography dataclasses

encode encryption fernet typing
7.5⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 265. Optimal fund raising

Here is another classic algorithm problem wrapped in a Bite. Enjoy! A mayor in a remote mountain village faced an …

3.10 algorithms looping

math
5.0⚬⚬⚬⚬⚬

        0

Bite 267. Measure the size of an island

In this algorithm Bite, the challenge is to measure the size of an island in the ocean, based on the …

3.10 algorithms looping

math
4.43⚬⚬⚬⚬

        0

Bite 271. Get all class names from a module

In this Bite you will write a function to get all the class names from the module passed in. Only …

3.10 inspect list comprehensions

2.5⚬⚬

        0

Bite 272. Find common words

Given two sentences that each contains words in case insensitive way, you have to check the common case insensitive words …

3.10 algorithms set operations

string matching
2.14⚬⚬

        0

Bite 274. Number conversion problem

Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances …

3.10 algorithms numbers

recursion
4.33⚬⚬⚬⚬

        0

Bite 275. Get the most common email domains

In this Bite you will process a list of emails determining what are the most common domain names. You only …

3.10 Counter requests

set string parsing web scraping
3.33⚬⚬⚬

        0

Bite 284. Pascal triangle

A Pascal triangle is a triangular array of integers constructed with the following characteristics: 1. The first row consists of …

3.10 algorithms Pascal

6.33⚬⚬⚬⚬⚬⚬

        0

Bite 285. Nested List Extraction

Sometimes dealing with data can be a real struggle. Sometimes it's delivered in a undesirable format that you have no …

3.10 data structures string parsing

5.67⚬⚬⚬⚬⚬⚬

        0

Bite 286. Decompress

Write a function, called decompress(), that accepts a string and a dictionary as input. The dictionary maps special character strings …

3.10 recursion string manipulation

4.0⚬⚬⚬⚬

        0

Bite 287. Sum indices

Write a function that accepts a list of strings and returns the total of the indices of the items.    …

3.10 looping sum

3.0⚬⚬⚬

        0

Bite 290. Class Rosters Data Conversion

You have been given a comma-delimited .csv file containing class roster data. Your task is to re-format this data so …

3.10 csv string parsing

tuple unpacking
2.5⚬⚬

        0

Bite 291. Find the fastest speech

In this Bite you will parse an SRT (SubRip Subtitle file / video captions or subtitles).  This is a snippet …

3.10 datetime sorting

string manipulation
4.0⚬⚬⚬⚬

        0

Bite 296. Jagged list

Write a function that takes an irregular shaped list of lists and makes it symmetrical by adding a fillvalue to each …

3.10 iteration itertools

list
2.67⚬⚬⚬

        0

Bite 298. Fasta to 2-Line Fasta

A very simple format to store biological sequence data is the (multi-)FASTA format. The first line of each record starts …

3.8 bioinformatics biopython

4.5⚬⚬⚬⚬

        0

Bite 299. Base converter

For this challenge, you are going to have write a function to convert a base 10 integer into any base, …

3.10 base exception handling

2.33⚬⚬

        0

Bite 301. Exchange rates

In this Bite you have to provide the currency exchange rates from EUR to USD and GBP for every day …

3.10 datetime dict

sorting
6.33⚬⚬⚬⚬⚬⚬

        0

Bite 302. Get and write all code from a JSON file

You are given a sample JSON file containing, among other things, PyBites code for two bites. Your task is to …

3.10 filecmp file processing

json string manipulation
1.5⚬⚬

        0

Bite 304. Most identical letters in a word

In this Bite, you will write a function called max_letter_word() to identify the first word with the most repeated letter …

3.10 casefold Counter

max string matching
7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 305. Split once, delimit many

Write a function that accepts a string and splits the text on the specified separators, but only on the first …

3.10 looping split

string parsing
5.0⚬⚬⚬⚬⚬

        0

Bite 306. Translate coding sequences to proteins

Genes can be converted (translated) to proteins using a three base decoding system as described in Bite 255. Your job is …

3.8 bioinformatics biopython

5.0⚬⚬⚬⚬⚬

        0

Bite 307. SQLite3 introduction

In this Bite, you are going to get some practice playing around with some structured query language (SQL) that's used …

3.10 databases SQL

sqlite3
9.5⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 308. Calculate the median from a dictionary

You are in charge of a program that continuously collects measurements. On demand, it outputs the median of the collected …

3.10 median sorting

sum
7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 309. A simple document class

When we want to transform our data often, method chaining is a wonderful paradigm that allows us to write elegant …

3.10 annotations classes

method chaining properties string
7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 311. Cleaning text with pandas

We recently published a blog post about how to approach Cleaning Text as part of a text mining project. In …

3.8 data cleaning pandas

TF-IDF
7.33⚬⚬⚬⚬⚬⚬⚬

        0

Bite 312. Scoring objects

In this Bite you are going to score objects: Object type Points builtin 1 keyword 2 module 3 Complete score_objects …

3.10 builtins importlib

keyword typing
9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 313. Alternative constructors

In this Bite your are provided with a Domain class and a DomainException custom exception class. You will add some …

3.10 classes classmethod

6.25⚬⚬⚬⚬⚬⚬

        0

Bite 315. More logging practice

In this Bite you will hone your logging skills by completing sum_even_numbers following the instructions in its docstring. Not only will …

3.10 exception handling logging

        0

Bite 316. To rent or to stream movies?

You're on a movie budget so you want to evaluate if streaming movies could be more economical than renting them. …

3.10 collections datetime

dict typing
3.0⚬⚬⚬

        0

Bite 320. sortable dataclasses and enums

Write an enum called BiteLevel and a dataclass called Bite following the instructions below. Make sure that the dataclass and …

3.10 dataclasses dunder methods

enum sorting

        0

Bite 346. Getting started with the IRIS data set

You are getting started with machine learning (ML)! Are you excited? I hope so. Machine Learning, at its core, is …

3.8 data wrangling machine learning

numpy pandas scikit-learn

        0

Bite 325. Floating point arithmetic

This Bite introduces you to a few issues associated with doing floating point arithmetic: the numbers that you 'see on …

3.10 arithmetic floats

numbers rounding

        0

Bite 326. Abstract Syntax Tree (AST) Printer

In this Bite we familiarise with Abstract Syntax Trees (ASTs). These are tree data structures used to describe source code …

3.10 AST 7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 332. Searching for an apartment

Bill is looking for a new apartment with good view, staying away from the crowed city.  He has been working …

3.10 algorithms 6.67⚬⚬⚬⚬⚬⚬⚬

        0

Bite 334. Simple TCP client

Your job is to write a simple TCP/IP client which will contact a server and exchange data: - The server …

3.10 client hashlib

multiprocessing networking secrets socket TCP/IP

        0

Bite 335. Async HTTP client

Your task in this Bite is to create an http client that will asynchronously send http requests and process responses. …

3.10 aiohttp asyncio

client networking

        0

Bite 338. Create food objects

Now with the Pydantic Food model defined we can start creating objects through FastAPI. Exciting! In this Bite you will …

3.10 FastAPI freebie

9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 339. Retrieve food objects

Now that our API can add food objects, let's retrieve them from the foods dictionary. In this Bite you will …

3.10 FastAPI freebie

5.0⚬⚬⚬⚬⚬

        0

Bite 340. Update and delete food objects

Now that we're able to create and retrieve Food objects, it's time to add code to update and delete them. …

3.10 FastAPI freebie

5.0⚬⚬⚬⚬⚬

        0

Bite 341. Pydantic part II

In order to measure daily food intake as a user our current Food model is not enough. We also need …

3.10 FastAPI freebie

Pydantic
5.0⚬⚬⚬⚬⚬

        0

Bite 342. Food logging CRUD

In this Bite you will use the Pydantic FoodEntry model (which contains the Food and User models as well). You …

3.10 FastAPI freebie

3.5⚬⚬⚬⚬

        0

Bite 343. FastAPI Exception handling

In this Bite we'll take the API we built in the last exercise and add some more exception handling to …

3.10 FastAPI freebie

9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 344. Return an HTML response

You use FastAPI primarily to build APIs, but it can also be used as a web framework (although we think …

3.10 FastAPI freebie

        0

Bite 348. Citation indexes

Academic research innovates by publishing papers, i.e., documents collecting ideas and experimental results. Google Scholar -- powered by Google Search …

3.10 builtins exception handling

typing

        0

Bite 349. Writing better Spanish

Bob is a lazy typer and often forgets to accentuate his Spanish 😅 For example instead of Cuando era pequeño …

3.10 ascii dict

unicode unicodedata
5.0⚬⚬⚬⚬⚬

        0

Bite 351. Get spelling suggestions

Complete the get_spelling_suggestions() function that takes a word and returns a list of SuggestedWord tuples (see type hints) that have …

3.10 comparison namedtuple

TextBlob tuple unpacking typing

        0

Bite 352. Hash SQL statements

In this Bite you are going to implement a simple (and not 100% correct) hashing function for Structured Query Language …

3.10 hashlib SQL

        0

Bite 354. When to Use Command Line Option (CLI) Options and When CLI Arguments?

In Typer, you can use either typer.Option or typer.Argument. Well, you might have guessed it: CLI options are similar to …

3.10 command line Typer

        0

Bite 356. Using Typer Callbacks to Create Command Line Interface (CLI) Parameters

In the previous Bite you have created your first simple Typer application with several commands. You might have asked yourself, …

3.10 command line Typer

        0

Bite 358. Implementation of a Simple Typer Test

In this Bite, you will create a simple Typer test to check whether a Typer application behaves as expected. Check …

3.7 command line pytest

Typer

        0

Bite 361. Rich Excursion - Create Beautiful Tables

This will be a quick Bite showing you how to create a beautiful table with Rich. You might be surprised …

3.10 command line rich

Typer

        0

Bite 362. Add a Password Prompt to Your Command Line Interface (CLI)

Let's get serious. Your Command Line Interface (CLI) works and you want to authenticate who is using your application. Here …

3.10 command line Typer

        0

Bite 363. Movie Theater (Refactoring)

Refactor the code from invoice_to_be_refactored inside invoice_refactored and make it more readable. Currently the function exhibits the infamous Arrow anti …

3.10 clean code refactoring

2.0⚬⚬

        0

Bite 364. Create Wikipedia Lorem Ipsum text

Lorem Ipsum is text used to demonstrate layout in documents (such as web pages) without distracting reviewers with real content. This …

3.10 beautifulsoup list comprehensions

random regular expressions requests

        0

Bite 365. Rolling two dice for an advantage

Let's roll the dice! When playing a game where it is beneficial to roll a higher value, a player can …

3.10 itertools math

mean

        0

Bite 366. Goal Tracker

In this Bite, you build a function that tells you how far ahead or behind an annual goal you are. …

3.10 date datetime

tuple unpacking

        0

Bite 367. Add Pi Day to the calendar

Python has a brilliant but often overlooked module called calendar. In this Bite we use this module to print out …

3.10 calendar tuple unpacking

4.0⚬⚬⚬⚬

        0

Bite 368. Hello Types

Welcome to this type hinting learning path. In the Bites of this learning path you will annotate a lot of …

3.10 annotations type hinting

3.0⚬⚬⚬

        0

Bite 369. Advanced Type Hints

In the previous Bite you have started annotating code with basic type hints, using the built-in data types. In this …

3.10 annotations type hinting

        0

Bite 370. Getting started with vectors

In the previous two Bites you have annotated small pieces of code with type hints. In this Bite, instead of …

3.10 annotations type hinting

        0

Bite 374. Group Anagrams

As defined by the OED, an anagram is a word, phrase, or name formed by rearranging the letters of another. …

array defaultdict strings

5.0⚬⚬⚬⚬⚬

        0

Bite 375. Find All Letter Combinations of a Phone Number

The typical phone keypad (pictured) features numbers (0 - 9), letters mapped to some of those numbers (2 - 9, …

backtracking itertools strings

        0

Bite 377. Coins on the Table

You start with 1,001 pennies lined up on a table. Starting at the beginning each time, first you replace every …

math

        0


Bite Tags User rated
difficulty
More info /
forum

Bite 2. Regex Fun

Learn some Python regular expressions by completing the following three functions. Each function recieves a text string with different content, …

3.10 findall freebie

re regular expressions
4.96⚬⚬⚬⚬⚬

        0

Bite 11. Enrich a class with dunder methods

Let's enrich an Account class by adding dunder (aka special) methods to support the following: length of the object: len(acc) …

3.10 dunder methods functools

properties
4.12⚬⚬⚬⚬

        0

Bite 20. Write a context manager

Write a context manager to roll back a transaction on the given Account class. There are two special (aka dunder) …

3.10 context managers dunder methods

operator overloading with statement
5.21⚬⚬⚬⚬⚬

        0

Bite 23. Find words that are > 95% similar

Given a list of tags of our blog find the ones that have a similarity score of over 95% Don't …

3.10 difflib file processing

findall itertools SequenceMatcher
3.69⚬⚬⚬⚬

        0

Bite 24. ABC's and class inheritance

ABC's or Abstract Base Classes are great to enforce a common API for your subclasses. You define one or more …

3.10 ABCs abstractmethod

classes inheritance
4.93⚬⚬⚬⚬⚬

        0

Bite 31. Matrix multiplication / @ operator

Since 3.5 Python has a binary operator to be used for matrix multiplication: @, see PEP 465 -- A dedicated …

3.10 dunder methods __matmul__

operator overloading
7.67⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 34. Building a Karma app - implement the User class

This Bite is about implementing a User class that keeps track of karma points received (Bite idea came from our …

3.10 classes dunder methods

namedtuple operator overloading properties
4.53⚬⚬⚬⚬⚬

        0

Bite 40. Write a binary search algorithm

There are many ways to search for an item in an ordered collection. One of the slowest methods is to …

3.10 algorithms binary search

4.78⚬⚬⚬⚬⚬

        0

Bite 42. Number Guessing Game Class

In this Bite you implement a Game class to perform a number guessing game. It lets a user do a …

3.10 classes games

random
6.11⚬⚬⚬⚬⚬⚬

        0

Bite 50. Make a little PyBites search engine (feedparser)

Complete the program below to create a little search command line app to search the PyBites blog on tags. It …

3.10 any feedparser

list comprehensions namedtuple search
7.36⚬⚬⚬⚬⚬⚬⚬

        0

Bite 52. Create a movie quote API with Flask

In this Advanced Bite you will implement a full-blown CRUD app to manage movie quotes using Flask. Implement the following …

3.10 APIs Flask

movie data
6.78⚬⚬⚬⚬⚬⚬⚬

        0

Bite 53. Convert text into multiple columns

You run a news site and you got feedback that people read more if articles are printed in 2 or …

3.10 string manipulation 6.0⚬⚬⚬⚬⚬⚬

        0

Bite 58. Using argparse to interface with a grocery cart

Below is a Groceries class with add/delete/show/search methods. You as a Python Developer are asked to give your users a …

3.10 argparse 6.14⚬⚬⚬⚬⚬⚬

        0

Bite 61. Create a variable size Paw Patrol card deck with random actions

The Paw Patrol card deck consists of 32 cards ranging A1–A4 ... B1–B4 ... G1–G4 ... H1–H4. 8 of these …

3.10 itertools namedtuple

random string module
4.14⚬⚬⚬⚬

        0

Bite 63. Use an infinite iterator to simulate a traffic light

Complete traffic_light using itertools.cycle to return an infinite iterator to simulate a traffic light. When called it should return a State …

3.10 iterators itertools

namedtuple
2.27⚬⚬

        0

Bite 69. Regex Fun - part II

It's time for another Regex one! (here is part I) In this Bite you will complete 8 functions to hone …

3.10 re regular expressions

5.15⚬⚬⚬⚬⚬

        0

Bite 75. Parse Unix cal to a weekday mapping

In the last bite we return the weekday from a date object. And you probably used the calendar module. Unix …

3.10 re Unix

zip
4.57⚬⚬⚬⚬⚬

        0

Bite 76. The singledispatch countdown challenge

We are stoked and grateful to have Martin have you practice functools.singledispatch (new in Python 3.4). PEP 443 defines generic …

3.10 decorators functools

singledispatch
4.67⚬⚬⚬⚬⚬

        0

Bite 85. Write a score property

After Bite 19. Write a simple property let's write a bit more advanced one. In this Bite you are presented …

3.10 classes properties

4.36⚬⚬⚬⚬

        0

Bite 88. Write a performance monitoring context manager

It's time for Context Managers part II. In Bite 20 you used it to roll back a transaction implementing the …

3.10 context managers Counter

6.71⚬⚬⚬⚬⚬⚬⚬

        0

Bite 93. Rock-paper-scissors and generator's send

Generators are cool right?! Did you know you can send values into a generator by calling its send(value) method? Crazy …

3.10 coroutines games

random
5.38⚬⚬⚬⚬⚬

        0

Bite 94. Parse PyCon talk data from YouTube

PyCon2018 was awesome! But you clearly had to choose the whole time, so much was going on! In this Bite …

3.10 list comprehensions max

namedtuple
5.78⚬⚬⚬⚬⚬⚬

        0

Bite 98. Code your way out of a grid

Given a 2D grid of equal length x and y, can you print the route to go from 1 to …

3.10 looping namedtuple

numbers tuple unpacking
6.67⚬⚬⚬⚬⚬⚬⚬

        0

Bite 112. Social Media Username Validator

In this Bite you parse social_platforms below into a dict of Validator namedtuples. For each social network you should extract …

3.10 namedtuple range

re regular expressions string manipulation string matching typing
5.91⚬⚬⚬⚬⚬⚬

        0

Bite 121. Determine the strength of a password

In this Bite you evaluate the strength of a password. Complete the function below and return a score from 0 …

3.10 re string matching

5.0⚬⚬⚬⚬⚬

        0

Bite 124. Marvel data analysis

This is a simplified version of our Marvel Data Analysis we held at the Alicante PyChallengeDay. Complete most_popular_characters, max_and_min_years_new_characters and percentage_female …

3.10 Counter csv

data analysis list comprehensions rounding sum
4.56⚬⚬⚬⚬⚬

        0

Bite 126. The Emoji (Unicode) Bite

Python 3 supports Unicode so we can do cool stuff like ... emojis 😅 Let's play a bit with emoji-to-text …

3.10 emojis sys

unicode
5.0⚬⚬⚬⚬⚬

        0

Bite 131. Screen scraper

This is the output from using screenFetch on my junky computer. mohh@SERENiTY MMMMMMMMMMMMMMMMMMMMMMMMMmds+. OS: Mint 19 tara MMm----::-://////////////oymNMd+' Kernel: x86_64 …

3.10 dict index

regular expressions slicing string manipulation
3.4⚬⚬⚬

        0

Bite 134. Two Sums

Given a random list of numbers, your task is to find the two indices that added together equal the target …

3.10 index looping

sorting sum
4.8⚬⚬⚬⚬⚬

        0

Bite 139. Calculate a coding streak in days

In this Bite you are going to calculate the amount of days you are on a coding streak (consecutive days …

3.10 datetime string manipulation

timedelta
6.0⚬⚬⚬⚬⚬⚬

        0

Bite 145. Record Breakers

The data for this challenge comes from a subset of The National Centers for Environmental Information (NCEI) Daily Global Historical …

3.10 csv data analysis

pandas
8.73⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 152. Manipulate string decorator

Write a decorator called strip_range that replaces characters with dots. It takes a start and an end int argument that …

3.10 decorators kwargs

list string manipulation
6.27⚬⚬⚬⚬⚬⚬

        0

Bite 158. Subclass the list built-in

In this Bite you will complete IntList, a subclass of list, which should be able to do the following: >>> …

3.10 dunder methods exception handling

inheritance list mean median operator overloading properties statistics
6.6⚬⚬⚬⚬⚬⚬⚬

        0

Bite 160. 15-way Rock Paper Scissors

In this Bite you are going to write a 15-way Rock Paper Scissors game (this challenge first appeared as part …

3.10 csv dict

exception handling games
4.38⚬⚬⚬⚬

        0

Bite 164. CLI tool: HTML link converter (stdin to stdout)

In this Bite you are going to help your team out automating a boring task. They reached out to you …

3.10 data wrangling exception handling

html stdin string formatting string manipulation sys
4.2⚬⚬⚬⚬

        0

Bite 168. Ninja Rankings

PyBites is starting a campaign to try and pair up the highest ranking Ninjas with some of the lower ranking …

3.10 bisect classes

dataclasses dunder methods heapq tuples
7.12⚬⚬⚬⚬⚬⚬⚬

        0

Bite 174. String manipulation and metrics

This bite will get you to play around with creating a dataclass and some text manipulation, formatting, and metrics gathering. …

3.10 Counter dataclasses

list comprehensions properties string formatting string manipulation translate
8.27⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 170. Analyze McDonald's food data

In this Bite you are going to analyze some nutrition facts for McDonald's food, specially calories and proteinic rich options. …

3.10 data analysis pandas

4.8⚬⚬⚬⚬⚬

        0

Bite 171. Make a terminal spinner animation

In this Bite you will spice up your command line apps with a loader animation. You will use itertools.cycle and …

3.10 command line itertools

stdout sys time
4.7⚬⚬⚬⚬⚬

        0

Bite 177. Use Pandas to find most common genres in a movie excel sheet

Another pandas Bite: we took some fake movie data from Mockaroo, an awesome fake data service, and dumped it in …

3.10 data cleaning excel

groupby movie data pandas
6.17⚬⚬⚬⚬⚬⚬

        0

Bite 179. Strip comments from Python code

In this Bite you will strip off all comments from some Python source code. Complete strip_comments that takes some multiline …

3.10 comments regular expressions

string parsing
7.75⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 183. Analyze sales data with pandas

For this Bite we got some fake Excel sales data which we are going to analyze with pandas. First complete …

3.10 data analysis groupby

pandas
4.0⚬⚬⚬⚬

        0

Bite 196. Create a JS-like dict object

In this Bite we challenge you to make a dict-like object that supports attribute lookups, just like JS objects! Check …

3.10 classes dict

inheritance javascript
5.71⚬⚬⚬⚬⚬⚬

        0

Bite 198. Calculate my Mac's longest uptime

Given the following output, calculate the longest uptime / time between reboots: [bbelderbos@imac log]$ last reboot reboot ~ Wed Apr …

3.10 data wrangling datetime

dateutil string parsing
3.75⚬⚬⚬⚬

        0

Bite 200. 🥳 Minecraft Enchantable Items

My kids love Minecraft and they always want me to play with them. At times gathering resources can get boring …

3.10 beautifulsoup web scraping

9.45⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 204. Pomodoro with asyncio

This Bite explores asyncio and type-hinting. For this bite, you will be taking a simple Pomodoro timer and refactoring it …

3.10 asyncio pomodoro

4.0⚬⚬⚬⚬

        0

Bite 207. Cached property decorator

Given the sample class Planet, computing the mass attribute of an instance is a computationally expensive and time consuming operation. …

3.10 caching classes

decorators properties
6.64⚬⚬⚬⚬⚬⚬⚬

        0

Bite 211. Write a retry decorator

Write a retry decorator that retries executing the function it decorates. If the function raises an exception (any kind) it tries …

3.10 decorators exception handling

4.85⚬⚬⚬⚬⚬

        0

Bite 213. Code a translation fixer

Imagine you built PyBites' new translation feature. You managed to successfully get translated text for a Bite, but there's a …

3.10 regular expressions 5.6⚬⚬⚬⚬⚬⚬

        0

Bite 216. Parse an email header

Write a regular expression to extract 4 pieces of information from an email header: From email To email Subject Date …

3.10 regular expressions 5.9⚬⚬⚬⚬⚬⚬

        0

Bite 220. Analysing @pythonbytes RSS feed

Another feedparser exercise! In this Bite we're going to analyze the Python Bytes Podcast feed a bit completing the PythonBytes …

3.10 classes Counter

feedparser max min namedtuple regular expressions string matching type hinting
5.8⚬⚬⚬⚬⚬⚬

        0

Bite 224. Get sentences from a text

Here is another fun regex exercise for you: it's easy to split text by newline using splitlines. Now try to …

3.10 data wrangling regular expressions

string manipulation
4.86⚬⚬⚬⚬⚬

        0

Bite 229. Scrape best programming books

For this bite, you are going to scrape the books from 100 Best Programming Books of All Time. Only include …

3.10 beautifulsoup books

classes data cleaning data wrangling sorting web scraping
8.9⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 237. Get the dates Ninja belts were earned

Another real-world scenario: in this Bite you will parse a json output file with Bites scored at different dates (thanks …

3.10 datetime json

looping pandas sorting
5.33⚬⚬⚬⚬⚬

        0

Bite 240. Write tests for an Account class

In our third Test Bite you will write tests for (a reduced version of) the Account class Bob wrote for …

3.7 classes pytest

6.45⚬⚬⚬⚬⚬⚬

        0

Bite 242. Zodiacal data parsing

In this Bite we will write tests for a module that parses data from Zodiacal / The Zodiac API. See …

3.7 datetime fixtures

pytest
5.5⚬⚬⚬⚬⚬⚬

        0

Bite 248. Test a number guessing game

In this Bite you test a simple number guessing game (class). Ready to write some pytest code? Read on ... …

3.7 classes exception handling

games mock.patch pytest
7.14⚬⚬⚬⚬⚬⚬⚬

        0

Bite 249. Test a movie DB class

Time for fixtures, one of pytest's killer features or as Brian Okken said: pytest fixtures are one of the unique …

3.7 classes fixtures

movie data pytest SQL sqlite3
6.5⚬⚬⚬⚬⚬⚬

        0

Bite 250. PyBites URL Shortener

URL shortening is a technique on the World Wide Web in which a Uniform Resource Locator (URL) may be made …

3.10 decode dict

encode string manipulation string module type hinting
4.4⚬⚬⚬⚬

        0

Bite 260. Let's play with Pandas DataFrames

To this point in the Pandas learning path we have just looked at Series. DataFrames are only a small step …

3.10 dataframes pandas

8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 266. Composition, Inheritance, Abstract Base Class, what?

It’s not as bad as that sounds, really. If you don’t know the difference between composition and inheritance, I would …

3.10 ABCs abstractmethod

beautifulsoup composition dataclasses inheritance namedtuple string formatting typing urllib web scraping
9.44⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 269. Taxable Income Calculator

I have no idea what rabbit hole I followed to get to this point, but here I am. I found …

3.10 classes dataclasses

finance namedtuple properties typing
6.5⚬⚬⚬⚬⚬⚬

        0

Bite 268. Number Transformers

Inspired by the movie Transformer, John decides to design a "number transformer" as a test. It is capable to perfom …

3.10 algorithms numbers

8.22⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 273. Shortest path (Graph Bite)

Graph theory is popular in Math and Computer Science. A graph is a set of V of vertices and a …

3.10 algorithms computer science

graph
8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 276. Get Father's days by date and country

Happy belated Father's day (unless you are in Australia or Scandinavia).  We pulled some data from the web when Father's …

3.10 dateutil string manipulation

string parsing
5.33⚬⚬⚬⚬⚬

        0

Bite 277. Number of coin changes

Pat is going to apply for a cashier job in the local supermarket. His friends suggested to brush up his …

3.10 algorithms dynamic programming

8.75⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 280. Regular Expression Lookahead/Lookbehind

For this bite you are going to solve three different tasks, where each task becomes progressively more complicated.  Use the re …

3.10 lookahead lookbehind

regular expressions
7.67⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 281. Generating sales reports from Github data

In this bite you will learn how to process the output from a Github API call and generate a summary …

3.8 data analysis pandas

7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 282. Evaluate a Bridge hand

In this bite you will implement a BridgeHand class representing a collection of 13 playing cards randomly chosen from a …

3.10 classes enum

exception handling looping properties sorting
6.6⚬⚬⚬⚬⚬⚬⚬

        0

Bite 292. Scoring matrices

Proteins fulfill important functions in all organisms and consist of amino acids linked together in a specific order. Although single …

3.10 bioinformatics enumerate

looping numbers zip
7.2⚬⚬⚬⚬⚬⚬⚬

        0

Bite 294. Bowling score

If you've never tried bowling, it's a fun game to play but keeping score can be confusing when you're first …

3.10 games looping

numbers
7.5⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 297. Rename keys

The Data Processing Department was writing a script to import some json data into Python dictionaries for analysis, but their …

3.10 data cleaning dict

iteration
5.75⚬⚬⚬⚬⚬⚬

        0

Bite 300. 🥳 PTO Calculator

We've all been affected by COVID-19 in one way or another. One way that I've been affected is with my …

3.10 calendar datetime

exception handling looping numbers string formatting
8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 303. Unique genes

You have received a list of DNA sequences for a specific gene in the FASTA file format (see Bite 298). Your …

3.8 bioinformatics biopython

8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 310. Create file pairs

In this bite you will write a function that pairs filenames with each other. This is useful in the bioinformatics …

3.10 bioinformatics files

regular expressions
4.5⚬⚬⚬⚬

        0

Bite 321. Magic bytes

Magic numbers are bytes that can be used to uniquely identify certain file formats. Portable Network Graphics (PNG) files, for …

3.10 bytes csv

exception handling file processing images string parsing
9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 327. AST visitor

In Bite 312 we learned how to identify builtin functions, modules, and keywords when provided with a list of strings. …

3.10 AST 9.0⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 328. Longest coding streak

What is your longest streak of completed Bites? In Bite 139, you learned how to calculate your current coding streak. …

3.10 fromordinal itertools

timezones toordinal
7.0⚬⚬⚬⚬⚬⚬⚬

        0

Bite 329. Convert dict keys to snake case

In this Bite we will take a (nested) dict and transform its (string) keys to snake case. So for example …

3.10 algorithms recursion

string manipulation
6.5⚬⚬⚬⚬⚬⚬

        0

Bite 330. Simple Math Equation Solver

Your task is to write a simple math equation solver. Given a list of operators and an integer result, find …

3.10 exception handling itertools

list operations math operator

        0

Bite 331. Convolution in Neural Networks

Finally a Bite about deep learning! At least, about one of the major building blocks of modern deep learning architectures: …

3.10 deep learning numpy

10.0⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 333. Metropolis–Hastings Algorithm

In statistics and statistical physics, the Metropolis–Hastings algorithm is a Markov chain Monte Carlo (MCMC) method for obtaining a sequence …

3.10 algorithms Markov chain Monte Carlo

numpy statistics

        0

Bite 345. FastAPI Authentication with JWT (JSON Web Tokens)

Up to this point anyone can modify food entries in the food log API, for any user! That is not …

3.10 FastAPI freebie

        0

Bite 350. Learn to handle cron schedule expressions

Let your mind wander and tell us what you think about this expression: 0 0,12 1 */2 * And? What …

3.10 crontab dataclasses

datetime exception handling iteration
8.0⚬⚬⚬⚬⚬⚬⚬⚬

        0

Bite 359. Implementation of a More Sophisticated Typer Tests

Building up on the previous Bite, you now have the chance to dive deeper into writing tests for Typer. Therefore, …

3.7 command line Typer

        0

Bite 376. Art Thief

You are a professional art thief with a penchant for post-war American painting, sun-soaked French islands, and money. You have …

graph memoization recursion

        0

Bite 378. Organizational Chart

Of all the types of questions you are likely to encounter during a technical interview - assuming the interview is …

binary tree depth-first search graph traversal

3.67⚬⚬⚬⚬

        0

Bite 379. Hedge Maze

Imagine you're trapped in a mysterious maze, much like the hedge mazes from Saltburn (poor Felix) or The Shining or …

breadth-first graph traversal maze

        0