Sunday, August 2, 2015

Intro to Programming with Python - Tutorial 8 - Exercise

In the 8th tutorial in the introduction to programming with python series we introduced for loops.
The video tutorial can be found here:
https://www.youtube.com/watch?v=b8R9ysVd1sg

The exercise for this tutorial is to make the previous exercise, for tutorial 7, more flexible.
For this exercise:

  • Initialize an empty grades dictionary variable.
  • Prompt the user for the number of students in the class. 
  • Convert the number of students to an integer
  • Use a for loop to allow the user to enter each student name and grade and add them to the grades dictionary.
  • When finished print the grades dictionary back to the user in a more user friendly manner than what we did for the last exercise (See sample program output below)
Here is a sample output of running the program:


Here is the program itself for your reference:


No comments:

Post a Comment