Let’s make a simple game! Most of the games you play have an element of luck, which makes games fun and exciting. For instance, you toss a coin or roll a dice. You can also add an element of luck to your program by generating random numbers. In Python, you can do that by importing `random`!
Your task is to write short program that simulates a coin toss (by generating a random number using `random`). The toss will be heads or tails. Write this little game in `headsortails.py`!
-!- CODE language-text -!-Heads!
-!- CODE language-text -!-Tails!
CodeGrade is your virtual teaching assistant in your Python classroom. You teach, CodeGrade takes care of the rest.
Our 35 built-in fully automatically graded Introduction to Programming assignments are designed especially for middle school and high school coding education, in close collaboration with Harvard-Westlake School (Los Angeles, CA). You can start teaching Python at your school with confidence now. Or, easily scale your classroom with CodeGrade's tools.
Book a personal 30-minute demo now and we'll show you how to get started with CodeGrade in less than 1 hour!