Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSC 1 2 1 LAB 0 3 : REPETITION STRUCTURES GOALS In this lab assignment, students will demonstrate the ability to: Use loops to solve
CSC LAB :
REPETITION STRUCTURES
GOALS
In this lab assignment, students will demonstrate the ability to:
Use loops to solve problems
Create and use conditioncontrolled loops
Create and use countcontrolled loops
Calculate a running total
Create and use input validation loops
Create and use nested loops
NOTE: This lab document is a copyrighted work of Wake Tech Community College and the course instructor. Any posting of this document outside of Wake Tech is considered a copyright violation. Students who post these documents outside of Wake Tech are subject to academic and possible legal actions.
INSTRUCTIONS
In this lab, you will demonstrate your mastery of repetition structures.
Follow the instructions in each problem and submit the specified files. All problems will require that Python code be submitted as well as screenshots that prove the programs have been executed in PyCharm.
Problems and will start with code provided by the instructor that either needs to be fixed or completed. Problem will consist of a program that you create from scratch that meets the problem specification.
PROBLEMS
PROBLEM
In this problem, you are given a completed program that has errors. You need to fix the errors.
This flawed program is supposed to estimate the inventory of books, DVDs and games in Trish's Bargain Swap Shop.
Initially the program asks for the current number of books, DVDs and games.
The program then assumes that there will be a net gain of books per month, DVDs per month and games per month, and it shows the amounts of each item in stock each month for the next months.
The instructor has provided a file called LabPFixTheErrors.py
Download that file and rename it LabPpy
Copy that file into your PyCharm project.
Change the program header to include your name and the date.
Run the program AS IS and see if you can determine what is wrong with the program. Note: You do NOT need a screen shot of the error for this problem.
Correct all the errors. You should eventually be able to run the program with no errors that accurately produces a table like the sample output.
Sample Output:
What is the current number of books?
What is the current number of DVDs
What is the current number of games?
Month
Books:
DVDs:
Games:
Month
Books:
DVDs:
Games:
Month
Books:
DVDs:
Games:
Run this program using the PyCharm Terminal. Take a screenshot of the Terminal that includes the line showing where you started the program run with the results. Name the screenshot LabPouput.jpg
Submit both files, LabPpy and LabPoutput.jpg to Blackboard for credit.
PROBLEM
In this problem, you are given a partially completed program, and you need to update and fill in the rest of the program to produce the desired output.
This program should ask the user to enter a number of rows and a number of columns. The program will then print a pattern based on the user's input. The pattern follows these rules:
If the row is even numbered ndth etc. and the column is even numbered, then the character in that spot will be a blank or space character.
Otherwise, the character in that spot will be an asterisk:
Sample output :
How many rows?
How many columns?
Sample output :
How many rows?
How many columns?
HINT: Be careful about how the numbers work in your program. Often times a program may be counting numbers starting with when a user may be counting from
HINT: When determining if a number is even or odd, the modulus or remainder operator can be very helpful.
The instructor has provided a file called LabPFillThisIn.py Download that file and rename it LabPpy
Copy that file into your PyCharm project.
Change the program header to include your name and the date.
ONLY replace every instance of Fill this in with correct code that will enable the program to generate the patterns shown above.
Run this program using the PyCharm Terminal.
Take a screenshot of the Terminal that includes the line showing where you started the program run with the results.
Name the screenshot LabPouput.jpg
Submit both files, LabPpy and LabPoutput.jpg to Blackboard for credit.
PROBLEM
Trish at Bargain Swap Shop has been using the programs you developed for her and really likes them. Recently however, she hired a new cashier who isn't very good at data entry. In particular, she needs the program to catch data entry errors that are made and give the user a chance to reenter the data.
To help her out, you'll be taking the first program you developed for her Lab Problem
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started