Answer to Question #346623 in Python for Roseanne

Question #346623

This is the code and it doesn't run completely, I don't know what's wrong because it also says that there is no error/s at all. Hope you help me with this.



ign = input("Pick an In Game Name!: ")


print(" Welcome to the guessing game ", ign ,"! ")



import random


def guess_number(s):


randomnum = random.randint (1, s )


guessnum = 0


while guessnum != randomnum:


guessnum = int(input(f"Guess the number, choose an integer from 1 -{s}:"))



if guessnum < randomnum:


print ("Guess again the value is low!!")



elif guessnum > randomnum:


print ("Guess again the value is high!!")



print (" Congratulations! You guessed ",randomnum," Right! ")



guess_number= 10

1
Expert's answer
2022-05-31T10:03:28-0400
ign = input("Pick an In Game Name!: ")
print(" Welcome to the guessing game, ", ign ,"! ")


import random


def guess_number(s):
    randomnum = random.randint (1, s)
    guessnum = 0


    while guessnum != randomnum:
        guessnum = int(input(f"Guess the number, choose an integer from 1 -{s}:"))


        if guessnum < randomnum:
            print ("Guess again the value is low!!")
        elif guessnum > randomnum:
            print ("Guess again the value is high!!")
        
    print (" Congratulations! You guessed ",randomnum," Right! ")


guess_number(10) # you forgot brackets - function args must be in them

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS