Sep-18-2019, 03:51 AM
I'm trying to debug this and I'm not seeing where "limit" is not being called into "play_game"
File "c:\Users\Jason\Downloads\p5-2_guesses_1.py", line 40, in <module>
main()
File "c:\Users\Jason\Downloads\p5-2_guesses_1.py", line 33, in main
play_game()
builtins.TypeError: play_game() missing 1 required positional argument: 'limit'
#!/usr/bin/env python3 import random def display_title(): print("Guess the number!") print() def get_limit(): limit = int(input("Enter the upper limit for the range of numbers: ")) return limit def play_game(limit): number = random.randint(l, limit) print("I'm thinking of a number from 1 to " + str(limit) + "\n") while True: guess = int(input("Your guess: ")) if guess < number: print("Too low.") count += 1 elif guess >= number: print("Too high.") count += 1 elif guess == number: print("You guessed it in " + str(count) + " tries.\n") return def main(): display_title() again = "y" while again.lower() == "y": limit = get_limit() play_game() again = input("Play again? (y/n): ") print() print("Bye!") # if started as the main module, call the main function if __name__ == "__main__": main()the error code I'm getting is
File "c:\Users\Jason\Downloads\p5-2_guesses_1.py", line 40, in <module>
main()
File "c:\Users\Jason\Downloads\p5-2_guesses_1.py", line 33, in main
play_game()
builtins.TypeError: play_game() missing 1 required positional argument: 'limit'