In this solution video, Peggy Fisher walks through the process of printing out the letter grades for each student and the overall course average. Learn how she uses the loop statement to complete the task.
(tone)…- [Instructor] How did you make out with the challenge?…I hope you were successful and able to print out…all the letter grades associated…with the numeric grades in our list.…As well as finding the average for all the students.…I'd like to walk you through my approach to this problem.…But remember, everybody programs a little differently.…So, you might have used some different commands…or maybe approached it a little differently.…Here's the starting worksheet that was supplied…in your exercise files folder in chapter 02, 0207.…
As you can see we have a variable call grades…which is a list of 10 grades.…So, the first thing that I want to do…is to be able to print out a letter grade.…So, I'm going to go ahead and add a for loop.…So, my for loop will navigate or traverse all of my grades.…So, I do for, open parenthesis g…and then I use the left facing arrow…to indicate that g is going to represent…each value in my list called grades.…Next, I want to say if the grade is greater than 92.…
If it's greater than 92 then I want to print out an A.…
- Installing Scala
- Integrating with IDEs
- Creating variables
- Using special functions
- Basic types and operations
- Tuples, sets, maps, arrays, and lists
- Classes, fields, and methods
- Singleton objects
Skill Level Intermediate
1. Why Scala?
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.