Please enable JavaScript to use CodeHS

Punnett Square Generator

Students will use Turtle Graphics in Python to create their own Punnett Square generator. This course is designed for students who have taken or are taking a biology course. The approximate length of this course is 2-4 hours.


Units: 1
Timeframe: Unit
Contact Hours: 3

By the Numbers

Contact Hours 3
Lessons 6
Videos 6
Exercises 6


Unit Description
Punnett Square Generator: Explore how we can use a computer to perform calculations by creating your own Punnett Square generator! You will use Turtle Graphics in Python to place images and text on a canvas and then use if/else statements, string indexing, and string methods to print the resulting genotypes from each allele pair.


Click on a demo to test it out.

determineGenotype Function

Finalize Punnett Square Generator

Format of Course

The entirely web-based curriculum is made up of a series of learning items that introduce students to some fundamentals of programming. Each lesson is made up of short video tutorials, example programs, and programming exercises. The course is designed as an integrated, 3-4 hour long mini-unit, though schools implement it in a variety of ways.

Who is it for?

The Punnett Squares Generator mini-unit is designed for complete beginners with no previous background in computer science, though they should have some knowledge of Biology and the concept of punnett squares. The course is highly visual, dynamic, and interactive and should be used with high school Biology students.


Interested in teaching the Punnett Squares Generator mini-unit with CodeHS? Get in touch, so we can help you bring CodeHS to your school!

Bring to My School