If the operator does not print text

I have this code:

from Tools.scripts.treesync import raw_input

username = raw_input("Enter Username : ")
password = raw_input("Enter Password : ")

if username == "bert" and password == "peter":
        print("Logged in")

      

and I want to say logged in

, but he doesn't say anything. It just won't accept anything I do, does anyone know the answer?

(started today, so this might be a small fix)

EDIT: it should have been input

insteadraw_input

+3


source to share


2 answers


You don't need to import anything. Also raw_input was changed to input in Python 3. So

Your_variable = input("Enter input:")

I would do good.

If you want to use raw_input function in Python 3 then use

eval(input())

The difference between them earlier.



If you type 5 for input It takes a value, finds its type and stores it as an integer

A = input("Enter :")

      

Where, since raw_input stores it as a string

This has now changed, so just use input. And if you want to store something as a whole. Just use this.

a = int(input("Enter value: "))

+2


source


raw_input is a built-in function, you don't need to import anything. Just remove the first line and run it again.



0


source







All Articles