Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am attaching lab 5 and the feedback from Lab 5. My code from Lab 5 is messed up and I was not sure if

I am attaching lab 5 and the feedback from Lab 5. My code from Lab 5 is messed up and I was not sure if adding it would help get an answer. So the question would be how to clean lab 5 up and and complexity in order to fulfill the requuirements of Lab 6. So in essence this is a 2 part question. Here is my Lab 5 code and the feedback and then Lab 6 requirements.

My code is messed up. This is the feedback from my Professor. I am posting my code and his feedback. Any help would be appreciated.

I don't see that you submitted a test plan document. [-3 points] Your Pseudocode code is missing all of the indentation. No Python code runs, because main() (the last line of your program) is indented. That makes the call to main() part of main() instead of running it. You want the standalone main() statement at the left margin. The next issue is that you named both a variable and a function "raids_attended". When you "raids_attended = 0" in main(), the raids_attended() function definition is overwritten. raids_attended() also will not run because you defined it with a parameter, but you are not calling it with an argument. Similarly, output_raid_rank() and get_raider_core() are each called without an argument, but you defined each of them as accepting a parameter. The number of values between the parentheses must match - the function definition versus the call to the function. I don't see that you incorporated either of the required loops (a main requirement of Lab 4). Your output list should be raids_attended, rank_points, and raider_core, since those are the variables you are outputting. Indentation is still an issue for your Python "if" blocks. For example, in calculate_rank_points(), you have everything indented after the first "if" statement. That means that the other "if" statements will only execute if raids_attended == 0. You want all of the "if" statements in that function to be at the same indentation level. You'll never return rank_points, because the return statement is conditional that raids_attended == 0 *and* raids_attended > 3 at the same time.

__author__ = ' '  # Raider Points # Guild Awards Points Based on the Number of # Raids Attended and Rank the Raider based on number of raids attended # Award Rank to the Raider Based on Points Earned  # Input List: Raid  # Output List: Raid, points, evaluation  # Function Integer Raid_Attended()  # Declare Integer Raid  # Display " please enter the number of Raids you attended this month"  # Input Raid  # Return Raid  # End Function  def raids_attended(raids): raids = 0 raids = (input("Enter the number of raids you attended")) return raids_attended # Function Integer calculate_raider_points_earned ( Integer raids_attended) # Declare Integer point # If raids_attended == 0 Then # rank_point = 0 # Else If raids_attended == 1 Then # rank_point = 5 # Else If raids_attended == 2 Then # rank_point = 15 # Else If raids_attended == 3 Then # rank_point = 30 # Else If raids_attended > 3 Then # rank_point = 60 # End If # Return rank_point # End Function  def calculate_rank_points(raids_attended): rank_points = 0 if raids_attended == 0: rank_points = 0 if raids_attended == 1: rank_points = 5 if raids_attended == 2: rank_points = 15 if raids_attended == 3: rank_points = 30 elif raids_attended > 3: rank_points = 60 return rank_points # Module output_rank(Integer point_earned) # If rank_points == 0 Then # Display " The Raider is a Nub" # If rank_points == 5 Then # Display " The Raider is a casual" # If rank_points == 15 Then # Display " The Raider is a Trial_Raider " # If rank_points == 30 Then # Display "The Raider is a Core_Raider" # If rank_points >30 Then # Display" The Raider is a Slayer" # End If # End Module  def output_raid_rank(rank_points): if rank_points == 0: print("The Raider is a Nub") if rank_points == 5: print("The Raider is a casual") if rank_points == 15: print(" The Raider is a Trial_Raider") if rank_points == 30: print("The Raider is a Core_Raider") elif rank_points > 30: print("The Raider is a Slayer") # Function raider_core(Integer rank_points)  # Declare String raider_core  # If rank_points < 30 Then  # Set raider_core = "Not a Core Raider"  # Else  # Set raider_core = "A Core Raider"  # End If  # Return raider_core  # End Function  def get_raider_core(rank_points): get_raider_core = ""  if rank_points < 30: get_raider_core = "Not a Core Raider"  if rank_points >= 30: get_raider_core = "A Core Raider"   return get_raider_core # Module raider_rank( Integer raids_attended, Integer rank_points, String raider_core) # Display " The number of raids the Raider attended", raids_attended # Display " The rank points earned is", rank_points # Display " The final raider core is", raider_core # End Module def output_raider_core_info(raids_attended, rank_points, raider_core): print("The number of raids the Raider attended ", raids_attended) print(" The rank points earned is", rank_points) print("The Core Raider Rank is", raider_core) # Module main  # Declare raids_attended  # Declare rank_points  #Declare String raid_rank  # Set raids = raids_attended()  # set rank_points = ()  # Set core_raider_rank = core_raider(point)  # Call output_point(raids,rank,raider_corps)  # Call output_category(rank_points)  # End Module  def main(): raids_attended = 0 rank = 0 raider_core = ""   raids_attended = raids_attended() rank = output_raid_rank() core = get_raider_core() main() 

Your lab submission should consist of a single Python file, Lab5.py, uploaded to the Lab 5 Assignment folder. The Lab5.py file should meet all of the following requirements:

Your name given as the author.

Comments including a brief description of the program, Input List and Output List, and full pseudocode. Place the pseudocode for each module above the module's Python code.

The program must have at least one input and at least one output.

All user input must be validated. This means the user is not allowed to just enter any value. You must check the value, and ask the user to enter it again, and repeat this loop until the user enters a valid value.

Your program must use at least two arrays in meaningful ways. These two arrays can contain any type of values, as long as they are both used meaningfully in your program.

Your program must have at least one loop that accesses the data in the arrays. For example, you might have an input loop that asks the user to enter the data one element at a time (be sure to validate the data). Or, you might have an output loop that writes the data to the console. Or, you might have a calculation loop that calculates one or more values, such as minimum value, maximum value, averages, and so on. You can have all three of those types of loops, if you want (the Lab 5 walkthrough video shows an example of each).

Your program should be organized into separate modules. Each module should be "cohesive" and should only do one thing.

Use parameters and arguments to pass values into your modules (don't use global variables).

The Python code should run correctly, and the logic should match your pseudocode.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

Students also viewed these Databases questions

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago