'this python program guess a random number, how to calculate the average numberguesses?
import random
i went to add another function to calculate the number guesses def guess(x): randomNumb = random.randint(1, x) guess = 0 while guess != randomNumb : guess = int(input(f'entre number between 1 and {x} : ')) print(guess) if guess < randomNumb : print('guess is low') elif guess > randomNumb : print('guess is high') print(f'guess is right {randomNumb}') guess(100)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
