Help me create a code that will ask the user the guess the randomly generated integer by the computer using recursive function. Thanks!

Recommended Answers

All 2 Replies

Please read this thread for suggestions on how to post meaningful questions. Keep in mind that we expect you to show what you have done so far.

Good luck!

from random import randint
def guess():
    if int(input("Guess the number (1-10):"))==randint(1,10):
        print("Got it") 
     else:
        print("Wrong!")
        guess()
guess()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.