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
Colt1911 [192]
4 years ago
5

a. Your program generates a random number between 0 and 128 and keeps asking the user to guess the number until the user guesses

it correctly. b. If the user guesses a number that is lower or higher than the number to be guessed then indicate that information to the user as a ‘low guess’ or a ‘high guess’ so that the user can get to the correct guess quicker. c. The program keeps track on number of guesses taken by the user to get to the correct guess. This is user’s score. d. Your program asks user for the name and adds user’s name and the score in a file that keeps track of the scores by various users. e. At the end of the game, the program displays the top 3 scores (lowest 3 scores) along with the name of the users to conclude the game. John 4 Sam 7 Tony 10
Computers and Technology
1 answer:
geniusboy [140]4 years ago
3 0

Answer:

import random

arr=[]

frr=open("score.txt","w")

for i in range(128):

   arr.append(i)

def func1(lst):

   score=0

   name=input("enter your name: ")

   while True:

       answer=random.choice(arr)  

       guess=int(input("enter your guess number between 0-128: "))

       if answer is guess:

           print("right guess\ncongratulations.....")

           print("the answer was: "+str(answer))

           score+=1

           break

       elif guess < answer-20:

           print("you guessed too low....\ntry again")

           print("the answer was: "+str(answer))

       elif guess > answer+20:

           print("you guessed too high....\ntry again")

           print("the answer was: "+str(answer))

       else:

           print("incorrect guess\ntry again")

           print("the answer was: "+str(answer))

       ext=int(input("press 0 to exit:\npress 1 to continue: "))

       if ext is 0:

           break

       

   return "{} {}".format(name,score)

num=int(input("how many users will be taking part: "))

for i in range(num):

   frr.write("{}\n".format(func1(arr)))

frr.close()

frr1=open("score.txt","r")

line=frr1.readline()

while line:

   print(line)

   line=frr1.readline()          

frr1.close()    

Explanation:

this code is in python3 language

it is displaying the name and the score, you just need to adjust the top 3 scores and least 3 scores.

You might be interested in
A technician is buying a PC that will host three VMs running at the same time with the current configuration. The technician bel
raketka [301]

Answer:

B. SSD

Explanation:

VMs or virtual machines are virtually created environment for multiple operating system on a host operating system. The host operating system has an extension called Hyper-V. The hyper-V manager helps to manage the virtual machine's activities.

The VMs can hold applications in their respective containers, which requires a partition of the storage. So when more VMs are configured, more storage memory is required to store their individual data. The VMs in a computer system can share a network interface card.

7 0
3 years ago
What are the disadvantages of having too many featuresin a language?
AlekseyPX

Answer:

Disadvantage of having too many features in a language is that:

  • There are many functions with same name but perform different function or task so it will create an issue or problem.
  • Features do not duplicate one another as, there are different possible syntax for the same meaning.
  • In a mathematical function, sometimes user function and mathematical variable name collide with language base features so it will create problem.
4 0
3 years ago
What can save a computer from damage by sudden increases in voltage?
Simora [160]
Surge protector :) hope this helps
7 0
3 years ago
PLEASE HURRY!!<br> Look at the image below
levacccp [35]
Answer is power and base

Explanation: both power and base are number variables
8 0
3 years ago
Terminal emulation, especially the unprotected ____________________ protocol, should be blocked from any access to all internal
storchak [24]

Answer:

telnet

Explanation:

<h2><u>Fill in the blanks </u></h2>

Terminal emulation, especially the unprotected <u>telnet </u>protocol, should be blocked from any access to all internal servers from the public network.

3 0
3 years ago
Other questions:
  • Give reasons why mind-mapping software is important to project development.
    14·1 answer
  • What does TIA stand for?
    7·2 answers
  • Maxwell says three things Level Two Leaders do well are:
    6·1 answer
  • HELP URGENT
    12·2 answers
  • What are some (free) good animation websites (for PC/Microsoft) for a short informational video about homelessness?
    15·1 answer
  • Which of the following problems is least likely to be solved through grid computing? Financial risk modeling Gene analysis Linea
    14·1 answer
  • E-banking is also called: [1]
    9·1 answer
  • Can i get any information on this website i'd like to know what its for ?
    11·1 answer
  • What is the output of this program? age=4 if age &gt;5: print (“more”) else: print (“less”)
    7·1 answer
  • Michael is stuck due to an electric shock generated at the fridge. What should you do to save michael?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!