Question: Error in Python Code When Using Random.randint ( ) The below is my code. I am trying to set the arguments in Random.randint ( )

Error in Python Code When Using Random.randint()
The below is my code. I am trying to set the arguments in Random.randint() as the inputs upper bound and lower bound. However, I am getting the error in the picture.
# Guessing Game
# main.py
import random
import math
# Taking Inputs for lower & upper bounds of the range and number of guesses
lower_bound = input ("Enter Lower Bound: ")
upper_bound = input ("Enter Upper Bound: ")
n_Guesses = input ("Enter Maximum Number of Guesses: ")
# Generating random number between the lower and upper
x = random.randint(lower_bound, upper_bound)
print("You have only "+ n_Guesses, " chances to guess the integer between "+ lower_bound, "and "+ upper_bound)
# Initializing the number of guesses.
count =0
while count n_Guesses:
count +=1
# taking guessing number as input
guess = input ("Enter a number: ")
# Condition testing of the guess
if guess x:
print ("You guessed too small!")
if guess > x:
print ("You guessed too high!")
# If Guessing is more than required number of guesses, shows this output.
if count >= nGuesses:
print("
The number is %d"% x)
print("\tBetter Luck Next time!")
Error in Python Code When Using Random.randint (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!