Pick a number You will write a program that will simulate the game where two players try to guess a number and the one who's closest wins.
1. Random secret number from 1 to 10 or any larger range if you want.
2. Two players will guess
3. Determine who was closest.
4. Display the results of the round in a neat and organized fashion.
5. Add some kind of style to your print outs so that your display is nice

Answers

Answer 1
Answer:

In python 3+:

import random

secret_number = random.randint(1,10)

guess_one = int(input("Enter player one's guess: "))

guess_two = int(input("Enter player two's guess: "))

if abs(guess_one - secret_number) < abs(guess_two - secret_number):

   print(f"The secret number is {secret_number} and player 1 was closest")

elif abs(guess_one - secret_number) > abs(guess_two - secret_number):

   print(f"The secret number is {secret_number} and player 2 was closest")

else:

   print(f"The secret number is {secret_number} and it was a tie")

I hope this helps!


Related Questions

What does spreadsheet program allows a user to do? a. Perform complicated calculations automatically b. Deliver elegant presentation to a large audience easily c. Organize, send, and retrieve e-mails quickly d. Keep viruses from infecting their computers
If your body were a house, your skeleton would be the house's ___________.A. roomsB. roofC. wooden frame
The agency responsible for maintaining a database of all operational continuity facilities is:
What are the two main things an operating system does?
Current cannot exist withouta. voltage. b. resistance. c. an open circuit. d. all of these

MUST HELP FOR POINTS!!!!! HELP ME!!!!!!!!! I RLY NEED HELP ON THIS, plz give sincere answers that you truly believe are correct.Question 1 (Multiple Choice Worth 3 points)

(03.02 LC)

Integrity, positive attitude, and punctuality are considered __________ skills.
interpersonal
mathematical
personal
verbal


Question 2 (Multiple Choice Worth 3 points)

(03.02 LC)

What is the ability to pay attention to and interpret what other people are saying?
Collaboration
Decision-making
Listening
Problem-solving


Question 3 (Multiple Choice Worth 3 points)

(03.02 MC)

Devon keeps his commitments, submits work when it's due, and shows up when scheduled. What personal skill does Devon demonstrate?
Attire
Collaboration
Dependability
Verbal


Question 4 (True/False Worth 3 points)

(03.02 LC)

Curfew is an example of a workplace policy.
True
False


Question 5 (Multiple Choice Worth 3 points)

(03.02 MC)

A technology company only hires applicants who are under the age of 30. This company could face possible __________ consequences.
academic
gender
legal
technological

Answers

1.Integrity, positive attitude, and punctuality are considered _____personal_____ skills. 
2. Listening
3. 
Dependability 
4. False 
5. I am unsure of the last one but, I'm pretty sure it is academic

Had you guys go to prom by yourself or someone in your senior class

Answers

Answer: I didn’t have a “date”, I went with friends.

Answer:

by myself

Explaination: Iḿ not the social type

The command prompt found on Windows 7 and Windows 8 is very similar to the interface of what past operating system?a. Dos
b. Windows 95
c. Windows 98
d. Windows NT

Answers

The answer is (a.) DOS

DOS stands for Disk Operating System. MS-DOS is the operating system which has a command interface similar to the command prompt of Windows 7 and Windows 8. Among the options, DOS is the only OS which is has a command line interface. Others have graphics.

Flexplace and telecommuting are similar in that both allow you to _____. work in a location away from the office work different hours at the office work in a different location four days a week work different hours four days a week

Answers

Flexplace and telecommuting are similar in that both allow you to work in a different location four days a week. 

Answer:

work in a different location four days a week.

Which type of network treats all processors equally, and allows peripheral devices to be shared without going to a separate server?

Answers

The correct answer is P2P or peer-to-peer servers.

Hope I helped ;)

Which of the following expressions will produce a valid random integer between the int values m and n inclusive, where m < n?

Answers

Answer:

The solution code is written in Python:

m = 1

n = 5

d = random.randint(m, n)

Explanation:

To get a random integer between m and n inclusive, we can make use of Python randint method. It will take two parameters, m and n. By giving two integers as an input (e.g. 1 and 5) to randint, it will generate a random integer between 1 to 5 inclusive.