Question: Computer science intro Part I: Pentagonal Numbers (3 points) Pentagonal numbers are a sequence of integers where the nth integer in the sequence is defined
Computer science intro
Part I: Pentagonal Numbers (3 points) Pentagonal numbers are a sequence of integers where the nth integer in the sequence is defined as n (3n 1)/2 For example, the fourth pentagonal number (n = 4) is equal to 22. Complete the pentagonal() function, which takes a single positive integer argument and returns the corresponding pentagonal number, which also must be an integer.

Part II: Catch Me If You Can (3 points) Write a function that takes two parameters in this order: a distance in miles that an athlete has run and the number of minutes it took the athlete to run that distance. The function then computes and returns average speed that the athlete ran in miles per hour.

Part III: Ticket Price (3 points) Write a function that takes two parameters, in this order: a persons age and the standard price for a movie ticket. The function calculates a discount based on the rules shown below, subtracts the discount from the standard ticket price, and then returns the discounted price. if the person is at least 65 years old, he receives a 25% discount if the person is between 21 and 64, he pays full price if the person is between 16 and 20, he receives a 15% discount if the person is less than 16 years of age, he receives a 20% discount

using Anaconda
# In this part of the file it is very important that you write code inside # the functions only. If you write code in between the functions, then the # grading system will not be able to read your code or grade your work! def pentagonal(n): # Write your code here and edit the return statement below as needed. return -1 def ticket_price(age, standard_price): # Write your code here and edit the return statement below as needed. return -1 def runner_speed(miles, minutes): # Write your code here and edit the return statement below as needed. return -1 # Below you will see an if-statement and a few tests. It is REALLY important # that you not delete this if-statement or the tests inside. You may, however, # add more tests to the code below. You can format them however you like. if __name__ == "__main__": # Check the assignment itself to find what the correct outputs should be # for these tests. ############### Part 1 Tests ############### print('Testing pentagonal() for n = 3: ' + str(pentagonal(3))) print('Testing pentagonal() for n = 7: ' + str(pentagonal(7))) print('Testing pentagonal() for n = 1: ' + str(pentagonal(11))) # Write your own tests for Part 1 here! print() # prints a blank line ############### Part 2 Tests ############### print('Testing runner_speed() for miles = 4, minutes = 50: ' + str(runner_speed(4, 50))) print('Testing runner_speed() for miles = 8, minutes = 75: ' + str(runner_speed(8, 75))) print('Testing runner_speed() for miles = 2, minutes = 150: ' + str(runner_speed(2, 150))) # Write your own tests for Part 2 here! print() # prints a blank line ############### Part 3 Tests ############### print('Testing ticket_price() for age = 15, normal_price = 10: ' + str(ticket_price(15, 10))) print('Testing ticket_price() for age = 18, normal_price = 20: ' + str(ticket_price(18, 20))) print('Testing ticket_price() for age = 38, normal_price = 12: ' + str(ticket_price(38, 12))) print('Testing ticket_price() for age = 72, normal_price = 15: ' + str(ticket_price(72, 15))) # Write your own tests for Part 3 here! Examples: Function Call Return Value pentagonal (3) 12 pentagonal (7) 70 pentagonal (11) 176
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
