Read Chapter 3, review 2.3 (Lists) in Introduction to Computing using Python: An Application Development Focus, Second Edition by Ljubomir Perković.
Please document any collaboration relevant to this assignment, in the header comment of the source file, as described in the first assignment.
Implement the functions below in the file csc401_homework2.py which can be found on in the Week 2 folder. You should save the template file I provided and then modify that file by adding the bodies for the functions. When you do, make sure to remove the placeholder pass statements that are currently there.
1. Implement the function buy_tickets(age, ticket_type) so that it returns the price of a train ticket purchase, given 2 parameters:
1. age - the age of the purchaser
its data type is a positive integer
2. ticket_type- type of ticket being purchased
its data type is string with 2 legal values: “monthly” and “10-ride”
For the sake of this assignment you can assume that the parameters are always valid values.
This is the algorithm for calculating a ticket price:
a. standard 10-ride price is $38
b. standard monthly price is $159.50
c. If the purchaser is 65 or older, they get a 10% discount These test cases should all pass:
>>> buy_ticket(21, "10-ride") 38
>>> buy_ticket(21, "monthly") 159.5
>>> buy_ticket(70, "monthly") 143.55
>>> price = buy_ticket(70, "10-ride")
>>> price 34.2
2. Change the implementation of the function sequences() found in the csc401-homework2.py file so that the following three sequences are printed
by the for loops found in sequences(). The information below shows how you would call the function and what it would display as a result:
>>> sequences()
9 10 11 12 13 14 15
4 8 12 16 20 24 28
30 27 24 21 18 15 12
3. Implement the function shorten_text(word_list) that takes a list of strings as a parameter and for each word in the list. prints the first character + “…” + the last character of each string, one word per line. If the list provided as a parameter is empty, the function prints a message to that effect. If any of the strings are empty, they are skipped in the display. The information below shows how you would call the function shorten_text() and what it would display for a couple of parameters:
>>> shorten_text(['house', 'business', 'trees']) h...e
b...s
t...s
>>> shorten_text([]) Input is empty
>>> shorten_text([‘horse’, ‘’, ‘candy’] h...e
c...y
4. Implement a function find_multiples(number_list, target) that takes as parameters a list of numbers and a numeric value. It prints out each value from number_list that is a multiple of the target number. If an empty list is
provided as the first parameter, the function prints an error message. The information below shows how you would call the function and what it would display for some example parameters:
>>> find_multiples([1,2,3,4,5,6], 2)
2
4
6
>>> find_multiples([1,2,3,4,5,6], 3)
3
6
>>> find_multiples([], 0) No numbers provided
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme