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
vovikov84 [41]
3 years ago
11

Write a program for a simple game of guessing at a secret five-digit code. When the user enters a guess at the code, the program

returns two values: the number of digits in the guess that are in the correct position and the sum of those digits. For example, if the secret code is 53840, and the user guesses 83241, the digits 3 and 4.
Computers and Technology
1 answer:
Margaret [11]3 years ago
6 0

Answer:

from random import randint

winner  = False

number = str(randint(10000, 99999))

while (not winner):

   correct = 0

   total = 0

   guess = input()

   

   if(number==guess):

       winner = True

   else:

       for i in range(5):

           if(number[i] == guess[i]):

               correct+=1

               total+=int(number[i])

       

       print('Correct: '+ str(correct))

       print('Total: '+ str(total))

print('Winner')

Explanation:

I´m gonna show a solution in python 3

Step 1 import library for generate random number

from random import randint

Step 2 create necesary variables to get the number and if the player is winner or not

winner  = False

number = str(randint(10000, 99999))

Step 3 loop while the player is not the winner

while (not winner):

Step 4 get the player guess number

guess = input()

Step 5 validate if the player win

if(number==guess):

       winner = True

Step 6 if the player is not winner review what numbers are  in the correct position

for i in range(5):

           if(number[i] == guess[i]):

               correct+=1

               total+=int(number[i])

Step 7 print the hint

print('Correct: '+ str(correct))

print('Total: '+ str(total))

You might be interested in
Kyra needs help planning what images and text to use in her web page what technique can help her
Hatshy [7]

it is the story boarding because when you want to plan you nd a story boarding so you can plan your Images

5 0
3 years ago
Read 2 more answers
Which option best describes the cheapest way to file your federal income taxes?
Triss [41]
<span>C. Complete it yourself using pencil and paper. For most people it is relatively simple to file taxes, barring any factors like retirement accounts or other income like capital gains. Online software can be useful, too, but often carries unforeseen fees that can be avoided by simply filing the tax paperwork yourself.</span>
3 0
3 years ago
Your company just installed a new web server within your DMZ. You have been asked to open up the port for secure web browsing on
alexdok [17]

Answer:

The port that should be set open to allow users to access this new server is:

TCP port.

Explanation:

Ports are openings or entrance doors through which data packages have access to a PC or server.  TCP and UDP are transport protocols with port numbers.  TCP means Transmission Control Protocol.  They are used to connect two devices over the internet and other networks.  UDP means User Datagram Protocol.  They are used to connect applications and to speed the transfer of data.  Comparatively, UDP is faster, simpler, and more efficient than TCP.  TCP enables retransmission of lost data packets, which UDP cannot do.

5 0
3 years ago
Rerouting traffic using arp poisoning is an attack on ________ of a network.
Arada [10]
Rerouting traffic using ARP poisoning is an attack on both the functionality  and confidentiality of a network. This is also known as ARP spoofing. This type of attack takes a legitimate IP address of another host and causes traffic redirection to an infected page. 
5 0
3 years ago
______ is a disadvantage of EDI.
Artist 52 [7]

Answer:The number of standards

Explanation:Electronic data interchange (EDI)  is the mechanism through which data is interchanged in the system electronically.It is mostly found in the business field for exchanging of data.

As EDI helps in making message accurate by decreasing the length and also has beneficial features of maintaining the security and increasing productivity ,hence these factor are not considered as the disadvantage .

Too many standard present in the EDI make the working complex by limiting the processing in the small business as compared with large organization.

 

6 0
3 years ago
Other questions:
  • A geologist is part of what career feild
    6·1 answer
  • Which of the following is the correct code to link the text "Sunny Days" to the website www.sunnysunshine.com?
    15·1 answer
  • When a client computer wants to connect to a service instance, what specific name type does it use to find the service?
    9·1 answer
  • What is online school like 6 sentences
    12·1 answer
  • What is the reasoning you would write an inquiry to a company?
    5·2 answers
  • Two types of formulas in Excel, what are they? A. Complex and simple, B. General and currency, C. Logical and Boolean, D. Trig a
    15·1 answer
  • What are the advantages of saving files in a cloud? <br>Please help!! ​
    11·2 answers
  • HELP!!!
    15·2 answers
  • ....is an act of introducing an invention into market on business basis for profit​
    12·1 answer
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!