Python 1.6

Circle Area Calculator

  • Fully automatically graded on code quality, style, structure and functionality
  • Students write their solution in an online IDE in their LMS
  • Check for Python code plagiarism


  • To have learned about print statements.
  • To have learned about arithmetics.

Learning goals:

  • Get familiar using variables in Python.
  • Get familiar with using constants in Python.
Get access to an autograder, plagiarism checker and online IDE for this assignment now!


Now that we have worked with variables, we can start working with a special type of variable: constants. A constant is a variable that, like the name suggests, does not change value (or has a “constant” value). Variable names are written in lowercase but, the convention is to give variables that do not change their value (i.e. constants) an uppercase name: e.g. `GRAVITY`.

For our second formula, we will define two variables that we need in order to calculate the area of a circle, `PI` and `radius`. As always, use the correct names for your variables and assign `PI` the value of `3.14`.

Again, your program should only print the solution of the calculation. Call your program ``. The example output below is for a circle with a radius of `5`.

Please note: It is usually a bad practice to define your own common constants like pi, as they are already available in Python’s math module. You will learn more about the math module later in this course.

Example usage:

-!- CODE language-bash -!-$ python3

Learn more:

Start teaching Python now

CodeGrade is your virtual teaching assistant for your coding classroom. You teach, CodeGrade takes care of the rest.

With our 40+ built-in fully automatically graded Introduction to Python assignments for university-level courses, you can start teaching Python at your institution with confidence now. Or, 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!

Book a demo now!

Happy educators

  • Educators who use CodeGrade have less stress.
  • Educators who use CodeGrade have happier and more successful students.
  • Educators who use CodeGrade have a simpler teaching workflow.

Schedule a personalized tour of CodeGrade today.