1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IgorLugansk [536]
2 years ago
5

Write a program that simulates a fishing game. In this game, a six-sided die is rolled to determine what the user has caught. Ea

ch possible item is worth a certain number of fishing points. The points will remain hidden until the user is finished fishing, and then a message is displayed congratulating the user depending on the number of fishing points gained.
Computers and Technology
1 answer:
m_a_m_a [10]2 years ago
3 0

Answer:

Answered below

Explanation:

//Python code

numberOfCasts = 3

j = 0

fishingPoints = 0

sum = 0

while j < numberOfCasts:

dieNum = randint(1 , 6)

if dieNum ==1:

fishingPoints = 2

elif dieNum == 2:

fishingPoints = 4

elif dieNum == 3:

fishingPoints = 6

elif dieNum == 4:

fishingPoints = 8

elif dieNum == 5:

fishingPoints = 10

elif dieNum ==6:

fishingPoints = 12

sum += fishingPoints

j++

if sum > 30:

print ("Great catch")

elif sum > 10 and sum <= 30:

print("Good catch")

else:

print ("Bad day")

You might be interested in
python A pet shop wants to give a discount to its clients if they buy one or more pets. The discount is equal to 20 percent of t
Artyom0805 [142]

Answer:

The following are the program in the Python Programming Language.

#define function

def discount(prices, isPet, nItems):

 # declare and initialize variables to 0

 i = 0

 cost = 0

 pets = 0

 item = 0

 item_Cost = 0

 #set the while loop

 while(i < nItems):

   #check the items of the variable

   if isPet[i]:

     #add and initialize in the cost

     cost += prices[i]

     #increament in the variable by 1

     pets += 1

   #otherwise

   else:

     #add and initialize in the item_Cost

     item_Cost += prices[i]

     #increament in the variable by 1

     item += 1

   #then increment in the variable by 1

   i += 1

 #check the pet is greater than equal to 1  

 #and item is greater than equal to 5

 if(pets >= 1 and item >=5):

   #then, print the message

   print("You receive discount")

   #set discount of the items

   discount = 0.2 * item_Cost

   # calculate bill after deducting discount

   bill = cost + item_Cost - discount

   #print the bill

   print("Final Bill amount is", bill)

 #otherwise

 else:

   #print the message

   print("You do not receive any discount")

   #calculate bill without deducting discount

   bill = cost + item_Cost

   #print the final bill

   print("Final Bill amount is", bill)

#set empty list type variables

price = []

pet = []

#set the infinite loop

while True:

 #get input from the user

 sprice = int(input("Enter the price (-1 to quit): "))

 #check that price is not equal to the -1

 if(sprice != -1):

   #add price in the list

   price.append(sprice)

   #ask for choice from the user

   choice = input("Is it a pet (Y / N)? ")

   #check the choice of the user is y or Y

   if(choice == 'Y' or choice == 'y'):

     # then, add in the pet

     pet.append(True)

   #otherwise

   else:

     #not add in the pet

     pet.append(False)

   print("")

 #break the loop

 else:

   break

#declare variable that store the length

items = len(price)

#call and initialize the variable

discount(price, pet, items)

<u>Output</u>:

Enter the price (-1 to quit): 96

Is it a pet (Y / N)? y

Enter the price (-1 to quit): 69

Is it a pet (Y / N)? n

Enter the price (-1 to quit): 41

Is it a pet (Y / N)? n

Enter the price (-1 to quit): 52

Is it a pet (Y / N)? n

Enter the price (-1 to quit): 96

Is it a pet (Y / N)? n

Enter the price (-1 to quit): 74

Is it a pet (Y / N)? n

Enter the price (-1 to quit): -1

You receive discount

Final Bill amount is 361.6

Explanation:

<u>The following are the description of the program</u>.

  • Firstly, define the function 'discount()' and pass the arguments 'prices', 'isPet' and 'nItems' in its parameter.
  • Then, declare and initialize the variables 'i' to 0, 'item_Cost' to 0
  • , item to 0, 'cost' to 0 and 'pets' to 0.
  • Then, set the while loop to add the price of the items and the cost of the pets.
  • Set the if-else conditional statement to check the pet is greater than equal to 1 and the items are greater than equal to 5 then, set the discount and print the bill after deduction.
  • Otherwise, print the bill without deduction.
  • Finally, set two list type variable then, set the infinite while loop that gets input from the user and check that the variable is not equal to -1 then append the data in the list then again check the user input then append in pet otherwise not append in pet and break the loop. Then, set the variable that stores the length of the price and call the following function by passing arguments in its parameter.
8 0
2 years ago
Henry is studying the effects of deforestation along the slopes of hills and mountains. He wants to take a photo of a mountain s
Annette [7]

Answer:

1) pull out the legs of the tripod to gain the required height and necessary stability

2) adjust each of the legs so that the tripod is level

3) attach the camera to the tripod

5 0
3 years ago
List out two ways to execute the script.​
castortr0y [4]

Answer:

1) Execute Shell Script Using File Name. Use the shell script file name to execute it either by using it's relative path or absolute path as shown below

2) Execute Shell Script Using Source Command.

7 0
2 years ago
Read 2 more answers
What type of coverage pays for damage incurred as a result of theft, vandalism, fire or natural disaster?
Sloan [31]

Comprehensive or hazard insurance

5 0
3 years ago
What is the most important trait of the first pilot project in the AI Transformation Playbook?
MissTica

Answer:

Succeed and show traction within 6-10 months.

Explanation:

Ai (Artificial Inteliigence), also known as machine intelligence, is a branch of computer science that is specialized in making smart machines that are capable of doing human tasks

AI Transformation Playbook is a guide to use AI in enterprises successfully, written by Co-founder of Google Brain, Andrew Ng. In his guide, he unveiled the steps that can be followed to successfully installing AI in enterprises, companies, etc.

The most important trait of the first pilot projects is that it succeeds and begins to show traction within 6-10 months.

In his guide, he summarised five steps to install AI in enterprises. The first step is to 'Execute pilot projects to gain  momentum.'

The most important trait of beginning with AI projects is that it succeeds first before being most valuable projects. The success is important as it will help to achieve familiarity and will help other people of the company to invest in this project more.

This success begins to show tractions within 6-12 months of its success.

8 0
3 years ago
Other questions:
  • Directions Use your imagination and a word processor to write a business letter with two to three paragraphs. Your business lett
    5·1 answer
  • Jamie has to enter names, grades, and scores of a group of students into a worksheet. Which option will Jamie use to describe th
    11·1 answer
  • If you want to wrap text so that it fits a particular cell size, which formatting section would you use?
    9·2 answers
  • True or False <br><br> The term virus and malware may be used interchangeably.
    13·1 answer
  • What’s the most popular operating system
    9·2 answers
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • HELP PLS TIME LIMIT HERE
    11·1 answer
  • Select the correct answer.
    12·1 answer
  • what could a company do if it was using a commercial wan and a vulnerability appered thst allowed attackers
    11·1 answer
  • Monster Collector
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!