Python 2.1

Hello Name

  • 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

Pre-requisites:

  • Print statement.

Learning goals:

  • Learn how to ask the user for input.
  • Create a first I/O script.
Get access to an autograder, plagiarism checker and online IDE for this assignment now!

Task:

Up until now, the output of the assignments you have created has been a bit boring. That’s because all the scripts we’ve made until this point have been static, they could only supply the same output every time they were run (unless you changed the source code). We are now going to make them a bit more interesting, by making them dynamic. We can do that by asking the user for input, and making our output dependent on this input. This is what makes most software so powerful too: processing given user input to produce a specific output.

For this task, you will create just that: a small first script that uses input to produce a specific output. Write a simple script called `hello.py`, which should ask the user to input their name and then print the exact string `“Hello {name}!”` to the screen.

Example usage:

-!- CODE language-bash -!-$ python3 hello.py
Please write your name: CodeGrade
Hello CodeGrade!

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.