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
notsponge [240]
3 years ago
13

Write a simple number guessing game Python program. In this code, generate a random integer between 1-10 (both included) and ask

the user to guess the number in three attempts. Print appropriate responses to the user such as "You won!" or "You failed"
Computers and Technology
1 answer:
seraphim [82]3 years ago
6 0

Answer:

from random import randint

num = randint(1,10)

count =0

while count<3:

 userNum = int(input("Guess a Number "))

 if num ==userNum:

   print("You won")

   break

 else:

   print("Wrong try again")

 count = count+1

Explanation:

Import randint from random

generate a random number between (1,10) and assign to num

create a loop control variable count set to 0

In a While statement with the condition count<3 prompt user to make a guess

if guess is correct print you won and break

else print wrong try again and increase count by 1

You might be interested in
A large population of ALOHA users manages to generate 50 requests/sec, including both originals and retransmissions. Time is slo
krok68 [10]

Answer:

The answer is below

Explanation:

Given that:

Frame transmission time (X) = 40 ms

Requests = 50 requests/sec, Therefore the arrival rate for frame (G) = 50 request * 40 ms = 2 request

a) Probability that there is success on the first attempt = e^{-G}G^k but k = 0, therefore Probability that there is success on the first attempt = e^{-G}=e^{-2}=0.135

b) probability of exactly k collisions and then a success = P(collisions in k attempts) × P(success in k+1 attempt)

P(collisions in k attempts) = [1-Probability that there is success on the first attempt]^k = [1-e^{-G}]^k=[1-0.135]^k=0.865^k

P(success in k+1 attempt) = e^{-G}=e^{-2}=0.135

Probability of exactly k collisions and then a success = 0.865^k0.135

c) Expected number of transmission attempts needed = probability of success in k transmission = e^{G}=e^{2}=7.389

6 0
3 years ago
What was the best Metal Gear Solid you enjoyed the most?​
kenny6666 [7]

My personal favorite is Metal gear solid 3: <em>Snake eater</em>.

7 0
3 years ago
8.4 Lesson Practice <br> edhesive quiz
kow [346]

Answer:

1. 5

2. Because they let us quickly process the contents of an array, which have many values.

Explanation:

8 0
3 years ago
In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
Trava [24]

Answer:

" CRL (certificate revocation list)" is the appropriate answer.

Explanation:

  • A collection of such subscriber bases containing accreditation or certification status combined with the validation, revocation, or outdated certification within each final customer is known as CRL.
  • Only certain subscribing workstations with a certain underlying cause authentication system should have been duplicated.
4 0
3 years ago
Write a program that reads three numbers and prints "increasing" if they are in increasing order, "decreasing" if they are in de
Lemur [1.5K]
You could assign values to variables and break it up into if else-if else statements.

<span>Pseudocode:</span>

if a < b and b < c:
    print("increasing")

else if a > b and b > c:
    print("decreasing")

else:
    print("neither")

Hope this helps.
7 0
3 years ago
Other questions:
  • Select the proper ergonomic keyboarding techniques.
    15·2 answers
  • 14. What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • Obtain a file name from the user, which will contain data pertaining to a 2D array Create a file for each of the following: aver
    5·1 answer
  • To what are multiple servers arranged in racks related
    14·2 answers
  • How do I mirror cast my smart lg tv?​
    11·1 answer
  • I need help with this problem please
    9·1 answer
  • A subroutine may be used to refer to which of the following? Check all that apply.
    15·2 answers
  • One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed.
    13·1 answer
  • How would you delete a slide from your presentation after selecting it?
    14·1 answer
  • Who designed the apple i computer in 1976?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!