Question

In: Computer Science

First, the Python program prompts user to enter user information (name, email, and phone number). Then...

First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type:

1. Cat Fish 2. Red Fish 3. Any other fish

Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria:

Criteria: Length:

FISHTYPE - Cat Fish <10: "throw back" >=10 through <=25: "keep" >25: "tag"

FISHTYPE – Red Fish <15: "throw back" >=15 through <=30: "keep" >30: "tag"

FISHTYPE – any other fish <10: "throw back" >=20: "keep"

Let the user to enter as many times they want using loops and save all the input data using List.

At the end, the program will display the user’s information and all the fish information.

Solutions

Expert Solution

Python program :

name = input("Please, enter your name: ")            # ask name of user
email = input("Please, enter your email: ")          # ask email of user
phone = input("Please, enter your phone number: ")   # ask phone number of user
print("Menu:")                                       # print menu for user
print("------")
print("1.Cat Fish")
print("2.Red Fish")
print("3.Any other fish")
option = int(input("Choose a fish type or 0 to exit: ")) # ask user to choose a option
data = []                                            # data is a list to store user information
while option!=0:                                     # while loop to exit when option entered by user is 0
    length = int(input("Enter length of fish: "))    # ask user to enter length of fish
    if option == 1:                                  # if the option is 1 then user choosed cat fish
        if length<10:                                # check if length is less than 10
            data.append("throw back")
        elif length>=10 and length<=25:              # check if length is in [10,25]
            data.append("keep")
        else:                                        # check if length is greater than 25 and add the data accordingly
            data.append("tag")
    if option == 2:                                  # if the option is 2 then user choosed red fish
        if length<15:
            data.append("throw back")
        elif length>=15 and length<=30:
            data.append("keep")
        else:
            data.append("tag")
    if option == 3:                                  # if the option is 3 then user choosed any other fish
        if length<10:
            data.append("throw back")
        if length>=20:
            data.append("keep")   
    option = int(input("Choose a fish type or 0 to exit: ")) # again ask user to choose for a option
print("\nUser information is :")                     # print user information
print("Name :",name)
print("Email :",email)
print("Phone Number:",phone)
print("\nFish information is :")                     # print fish information
n = len(data)
for i in range(n):
    print(data[i])
    

Screenshot :


Related Solutions

python.Write a python program that prompts the user to enter the year and first day of...
python.Write a python program that prompts the user to enter the year and first day of the year, and displays the first day of each month in the year. For example, if the user entered the year 2020 and 3 for Wednesday, January 1, 2020, your program should display the following output: January 1, 2020 is Wednesday February 1, 2020 is Saturday …… December 1, 2020 is Tuesday
Python A program which prompts the user to enter an number which is a integer n...
Python A program which prompts the user to enter an number which is a integer n and creates a tuple where the values are all numbers between 1 and n (both inclusive). Note: you can assume that the integer will always be > 1. Input Result 3 Enter an integer: 3 (1, 2, 3)
(PYTHON) Lottery program. The program randomly generates a two-digit number, prompts the user to enter a...
(PYTHON) Lottery program. The program randomly generates a two-digit number, prompts the user to enter a single two- digit number, and determines whether the user wins according to the following rules. Write a loop to let the user play as many times as the user wanted. Use a sentinel or flag to quit out of the loop. 1.if the user’s input matches the lottery In the exact order, the award is $10,000. 2.if all the digits in the user’s input...
Python Code: Write a program to prompt the user to enter a first name, last name,...
Python Code: Write a program to prompt the user to enter a first name, last name, student ID, number of hours completed and GPA for 5 students. Use a loop to accept the data listed below. Save the records in a text file. Write a second program that reads the records from your new text file, then determines if the student qualifies for Dean’s list or probation. Display the records read from the file on screen with appropriate headings above...
jgrasp environment, java write a complete program that prompts the user to enter their first name,...
jgrasp environment, java write a complete program that prompts the user to enter their first name, middle name, and last name (separately). print out thier name and initials, exactly as shown: your name is: John Paul Chavez your initials are: J. P. C. use string method chartAt() to extract the first (zero-th) character from a name(the name is a string type): username.charAt(0). thank you.
In Python Create customer information system as follows: Ask the user to enter name, phonenumber, email....
In Python Create customer information system as follows: Ask the user to enter name, phonenumber, email. Create a file by his name and save it in the hard disk. Do this repeatedly until all the users are entered. (for example, if the user enters 10 customers’s information, there should be 10 different files created.) Now build the customer value for a retail company as follows: Ask the customer to enter his name. If you have his information already stored, then...
Write a program(Python) using functions and mainline logic which prompts the user to enter a number....
Write a program(Python) using functions and mainline logic which prompts the user to enter a number. The number must be at least 5 and at most 20. (In other words, between 5 and 20, inclusive.) The program then generates that number of random integers and stores them in a list. The random integers should range from 0 to 100. It should then display the following data to back to the user with appropriate labels: The list of integers The lowest...
You will write a program that prompts the user to enter a 7-digit phone numbers, and...
You will write a program that prompts the user to enter a 7-digit phone numbers, and finds the 3- and 4-letter words that map to the phone number, according to the restrictions outlined earlier. A sample run: unixlab% java MapNumbers Enter name of dictionary file: words10683 Enter a test word (3 letters): cat Test word maps to 228 Enter telephone number (7 digits, no 0's or 1's, negative to quit): 2282273 Options for first 3 digits: act cat bat Options...
Write a Python program that prompts the user to enter a list of words and stores...
Write a Python program that prompts the user to enter a list of words and stores in a list only those words whose first letter occurs again within the word (for example, 'Baboon'). The program should display the resulting list..................please explain step by step
Write a program function code in Python that prompts the user to enter the total of...
Write a program function code in Python that prompts the user to enter the total of his/her purchase and add 5% as the VAT. The program should display the total without and with VAT. ( that mean i should ask the user to enter the number of their item " so i think that i should use range" then print the result with and without the VAT )
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT