Part B: Draw Something In this portion of the lab you will draw an inverted triangle using loops. ********** ********* ******** ******* ****** ***** **** *** ** * Part B: Draw Something New! Write a complete and syntactically correct Python program to solve the following problem: You want to write a program that will take in the number of grades of the students in your class. Since the students in a class vary from semester to semester, there is no fixed number assigned to the number of students. You will keep track of how many students’ grade you input. You will stop taking input when the student enters a grade of minus 1 (-1). Your program will use loops and will accomplish the following: Read in a numeric grade from a student Convert the numeric grade to a letter grade using the grade policies in your syllabus. Keep a running total of the numeric grades entered. Keep a count of the number of grades entered. Issue a message that comments on the letter grade earned. As an example, you may write “You made an F! Obviously you did not study!” At the end of the program calculate a class average unless there were NO grades entered. All input to the program will be interactive from the keyboard. The output of the program will include the individual grades converted, the message issued to the student, a class average, and the number of grades entered.
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
For this portion of the lab, you will reuse the program you wrote in Lab 3A. Redesign this solution so that some portions of the code are repeated. In lab 3 you validated input to ensure that the user entered inputs within certain values. If the user entered an invalid value, the program terminated. Now you will add a loop such that the user gets three changes to enter a valid value. If the user enters an invalid value more than three times in a row, the program should issue an error message and terminate.
- Save the program as firstname_lastname_Lab4a.py where you will replace firstname and lastname with your actual first and last name.
- Test all conditions prior to submitting. If the user enters an invalid value, then the program will issue an error message and terminate immediately. (Do NOT accept further data).
Part B: Draw Something
In this portion of the lab you will draw an inverted triangle using loops.
**********
*********
********
*******
******
*****
****
***
**
*
Part B: Draw Something New!
Write a complete and syntactically correct Python program to solve the following problem:
You want to write a program that will take in the number of grades of the students in your class. Since the students in a class vary from semester to semester, there is no fixed number assigned to the number of students. You will keep track of how many students’ grade you input. You will stop taking input when the student enters a grade of
minus 1 (-1).
Your program will use loops and will accomplish the following:
- Read in a numeric grade from a student
- Convert the numeric grade to a letter grade using the grade policies in your syllabus.
- Keep a running total of the numeric grades entered.
- Keep a count of the number of grades entered.
- Issue a message that comments on the letter grade earned. As an example, you may write “You made an F! Obviously you did not study!”
- At the end of the program calculate a class average unless there were NO grades entered.
All input to the program will be interactive from the keyboard. The output of the program will include the individual grades converted, the message issued to the student, a class average, and the number of grades entered.
Use the IDLE
python
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images