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
In the context of object-oriented programming a(n) is a template for a group of objects with similar characteristics.
MArishka [77]

A class is a template for a group of objects with similar characteristics.

An object-oriented programming uses objects, instead of <em>functions and logic </em>to model software designs.

In an object-oriented programming, there are:

  • Objects
  • Classes
  • Methods
  • Etc

Objects are what make up the object-oriented programming.

Similar objects are grouped together into classes

Hence, the text that completes the blank is class

Read more about object-oriented programming at:

brainly.com/question/22530356

7 0
3 years ago
Which statement is NOT true:
RSB [31]

Answer:

The correct answer for the given question is   "Machine languages can be used to write programs that can run on any machine."

Explanation:

The machine language consist of binary digit i. e 0 and 1 .Computer can understand only the machine language .The machine language consist of code that is written in bits so it is used  to express algorithms.When any program is compiled the compiler are converted into machine code so the machine language is produced by the compiler .

Machine language cannot used to write a program that run on any machine.

5 0
3 years ago
Wassup everyone. what are you up to ?
ASHA 777 [7]

Answer:

Today is my birthday

Explanation:

And I'm very excited

6 0
3 years ago
Read 2 more answers
Which of the following are picture adjustments that can be made to images?
Masteriza [31]

Answer:

D - All of the above

Explanation:

8 0
3 years ago
Read 2 more answers
Prompt the user for a string that contains two strings separated by a comma. (1 pt)Examples of strings that can be accepted:Jill
Veronika [31]

Answer:

import java.util.Scanner;

public class ParseStrings {

public static void main(String[] args) {

/* Type your code here. */

Scanner sc= new Scanner(System.in);//to read inout from user

String sentence;//to hold user input

System.out.println("Enter input string");//asking user to input string reading into sentence

sentence=sc.nextLine();

while(!sentence.equals("q"))//continues untill user enters q

{

while(!sentence.contains(","))//loop ti eport error and continue till user enters valid string

{

System.out.println("No comma in string");

System.out.println("Enter input string");

sentence=sc.nextLine();

}

//extracting words from senetnece

String word1=sentence.substring(0, sentence.indexOf(',')).trim();

String word2=sentence.substring(sentence.indexOf(',')+1).trim();

System.out.println("First word:"+word1);

System.out.println("Second word:"+word2);

System.out.println("Enter input string");//asking user to input string reading into sentence

sentence=sc.nextLine();

}

 

return;

}

}

Explanation:

7 0
4 years ago
Other questions:
  • Write methods to do the following: a. Display three full lines of asterisks on the screen. b. Accept as an argument your name, a
    5·1 answer
  • What should be a technicians first step in an A/C system
    15·1 answer
  • What is a wireless network that provides communication over a short distance that is intended for use with devices that are owne
    14·2 answers
  • ERP implementation probably will not require:
    8·2 answers
  • Why transport layer is usingconnectionless services if network layer is providing connection oriented services?
    10·1 answer
  • Sales management wants a small subset of users with different profiles and roles to be able to view all data for compliance purp
    7·1 answer
  • Select the correct answer. Adrian sent his manager Stacy an email message that required her immediate attention. Stacy was unabl
    7·2 answers
  • Write a code that calculates the Greatest Common Divisor (GCD) of two positive integers (user-defined inputs). Include an except
    10·1 answer
  • When memory allocation is ____, it means all portions of the program and OS are loaded into sequential locations in memory.
    15·1 answer
  • A. Fill in the blanks:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!