Name:
Computer Science
Modified
Python Coding Section C
Directions: Circle the best answer.
1. If the code below, what is the maximum amount of gold that can be in a treasure chest?
def treasure_chest():
gold = random.randint (1, 10)
print ("the treasure chest contains", gold, "pieces of gold.")
#Main program begins here
import random
player_gold = 5
print("There is a treasure chest here.")
treasure_chest()
+ None
C. Five
b. One
d. Ten
2. What is the output of this program?
def say_hello() :
print("Hello World)
say_hello)
say_hello
a. Hello world! Hello world!
b. "Hello World" "Hello World!"
C. Hello Hello
# None of the above

Name:Computer ScienceModifiedPython Coding Section CDirections: Circle The Best Answer.1. If The Code

Answers

Answer 1

Answer:

The max Number would be D. TEN

Explanation:

Where it say the main program begins is where the use of import random is be using under the treasure chest function basicly the random.randint choose and random number between 1 through to 10..


Related Questions

someone, please answer this.

This lesson showed you the general form of the syntax for a for loop in JavaScript:for

(initialize counter; condition; update counter) {code block;}

What does each part do, and why is it necessary?

Answers

Answer: A loop will continue running until the defined condition returns false . ... You can type js for , js while or js do while to get more info on any of these. ... initialization - Run before the first execution on the loop. ... But it can be used to decrement a counter too. statement - Code to be repeated in the loop.

Explanation:

Implement the function printTwoLargest that inputs an arbitrary number of positive numbers from the user. The input of numbers stops when the first negative or zero value is entered by the user. The function then prints the two largest values entered by the user. If fewer than two distinct positive numbers are entered a message to that effect is printed instead of printing any numbers. Hint: Duplicates will cause problems. Try to make sure that you find a way to ignore them.

Answers

Answer:

The function in Python is as follows:

def printTwoLargest():

   chk = 0

   list1 = []

   num = int(input("Enter: "))

   while num > 0:

       for i in list1:

           if i == num:

               chk+=1

               break;

       if chk == 0:

           list1.append(num)

       chk = 0

       num = int(input("Enter: "))

   list1.sort()

   if len(list1) >= 2:

       print("Largest:", list1[-1])

       print("Second:", list1[-2])

   else:

       print("Length of list must be at least 2")

Explanation:

This defines the function

def printTwoLargest():

This initializes a check variable to 0

   chk = 0

This initializes an empty list

   list1 = []

This prompts the user for input

   num = int(input("Enter: "))

The following loop is repeated until input is 0 or negative

   while num > 0:

The following for loop checks for duplicate

       for i in list1:

           if i == num: If duplicate is found

               chk+=1 The check variable is set to 1

               break; And the for loop is exited

The input is appended to the list if the check variable is 0 (i.e. no duplicate)

       if chk == 0:

           list1.append(num)

This sets the check variable back to 0, for another input

       chk = 0

This prompts the user for another input

       num = int(input("Enter: "))

This sorts the list

   list1.sort()

This prints the two largest if valid user input is 2 or more

   if len(list1) >= 2:

       print("Largest:", list1[-1])

       print("Second:", list1[-2])

if otherwise, this prints that the length must be at least 2

   else:

       print("Length of list must be at least 2")

HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP HELP

Answers

Answer:

I should be C! :D

Answer:

B

Explanation:

Other Questions
The attendance at twenty-five high school football games was: 250, 400, 350, 750, 200, 1000, 1200, 800, 600, 900,400, 300, 500, 800, 650, 450, 550, 750, 350, 600, 1250, 1450, 1500, 800, and 950.Select all the samples whose mean attendance is above the mean attendance of the population250, 400, 350, 750, 2001000, 1200, 800, 600, 900400, 300, 500, 800, 650450, 550, 750, 350, 6001250, 1450, 1500, 800, 950 Which of the following could be a zero of f(x)=x4-10x3+35x2-50x+24 Shonda earns $10 per hour at Sneakers Plus. She is also paid a $2 commission on every pair of sneakers she sells. How much did Shonda earn if she worked 6 hours and sold 9 pairs of sneakers? What is the U.S constitution? Simplify.2x120x200 4x/54x" 52x "/10 Using the GCF factor the given expression: 21xy + 14y For which reason did the United States invade Afghanistan after September 11, 2001, attacks?A) to fight terrorisim by removing Taliban from powerB) to take over and claim Afghanistan as American territory C) to take full control of all of the Middle Easts oil supplyD) the negotiate terrorists and help al-Qaeda with supplies Solve 3x + 7 = 1 please show full working out Una pelota sale disparada desde el nivel del suelo, con una velocidad de 40 m/s y un ngulo de elevacin de 50. a) Calcule la altura mxima que alcanza la pelota Which expression is equivalent to 4(3n -5)? Please help me out on this!! a) If a/b=3/4, find: 6a+b/3a+2b What is the IUPAC name for Ester with 9 carbon atoms ? Melinda takes out a loan to purchase a car. The balance on her loan after x months is represented by the equation y = 10,000 250x and the value of the car after x months is represented by y = 8,000 50x. Which statement describes when Melindas loan will be equal to the value of the car?After 10 months, the loan and value of the car will both be equal to $7,500.After 12 months, the loan and value of the car will both be equal to $7,000.After 14 months, the loan and value of the car will both be equal to $6,500.After 16 months, the loan and value of the car will both be equal to $6,000. why Brass is alloyplease answer the question A patient received a topical medication from his doctor. Which form of medication did the patient most likely receive? 8 They fouD Circle the correct words.Look to the left and to the right before you across / cross the street.2 When I got on / in the bus, I saw my friend so I sat next to him.3 Just follow / walk the map and you will find the museum easily.4 A group of joggers ran along / through the park.5 Walk to the corner and then go ahead / straight on.6 My dog jumped over / past the gate and ran to the park.7 We drove through/ under the bridge and then turned right.8 Where do we get of/ off the bus? Is it at the next stop?ke this?buildings IN DESPERATE NEED OF HELP!!!! TIMED TEST!!! WILL GIVE BRAINLYEST!! No links or I will report u Uhhh help pls :D..... Need the answer ASAP!!!! Select the correct answer.What type would the object X be in the following statement: If (x) {...}A.number B.BooleanC.string D.date