0

So I'm developing a Python code for a school project, basic guess the number code, and when people enter a number I need the other people not to be able to see it on screen. This is the code I'm working with at the moment

l=1
import random
import random
a = random.randint(1,50)
b = random.randint(1,50)
while l:
   user_1 = str(input("Welcome player 1, please enter your name --> "))
   user_2 = str(input("Welcome player 2, please enter your name --> "))

   guess1 = int(input("(PLAYER1) Enter a number --> ")


   if a == guess1:
         print ("You guessed it!")
         break
   elif a > guess1:
         print ("Too low!")
   elif guess1 > 50:
         print ("Out of bounds, number must be between 1 and 50!")
   else:
      print ("Too high!")

I need it so that when I enter the number, it either shows an * or just doesn't show anything. I have tried a getpass.getpass module but it returns this error/warning: Warning (from warnings module):

  File "C:\Python34\lib\getpass.py", line 101
    return fallback_getpass(prompt, stream)
GetPassWarning: Can not control echo on the terminal.
Warning: Password input may be echoed.
Password: 

On top of that error, it doesn't work (blur the text). I'm using python 3.4.0 and I'm unable to change that, any help would be appreciated.

Edit: I notice this was marked as duplicate, only my version of python doesn't accept raw_inputs, as used in the duplicate text.

Sam Hockham
  • 23
  • 1
  • 6

0 Answers0