Hello!
Was hoping someone could help me here. I need to make a program that asks a user to ask for a range (min & max int) then guess between those range. I need to ask the user for a number (as a function used by 1 for an input, and in the main for getting a guess from the user that returns an int. Determines if that guess between the range is too low or too high. I also need 3 working functions besides the main one.
This is my "rough draft" that I have so far..
import random
def main():
print("")
print("Hello! Please give two numbers, a min and a max") # ask user for a min and max. then guess the number between
MinNumber = int(input("Select a Min: "))
MaxNumber = int(input("Select a Max: "))
if MinNumber > MaxNumber:
print("Please enter an integer that the maximum is large then the minimum")
return main()
else:
guess()
def guess():
ran = int(input("What is your guess: "))
guess(ran)
def ran():
guess = random.randint(MinNumber, MaxNumber)
print(guess) # Need to add function where if input =/ guess then ask to guess again
while:
if ran > guess:
print("Too high, try again") # make def to check if it's too high or too low
return guess()
elif ran < guess:
print("Too Low, try again")
return guess()
print("Excellent! You guessed the correct number!")
main()
This post was edited by RaiseIt on Oct 25 2018 09:49am