r/learnpython • • Jun 30 '22

help I'm new at python

id = input("enter your password: ") print(id == 369)

Why when I enter 369 in the console it displays false?

0 Upvotes

9 comments sorted by

12

u/VeinyAngus Jun 30 '22

Because ID is a string, so in the print you need to put the 369 in quotes

4

u/Waldlaeufer18 Jun 30 '22

As said ID is a string, but to say it clearly input()outputs are always strings, if you want to have any other type you need to use float(), list() or any other "type-changer" on the output.

5

u/[deleted] Jun 30 '22

because the password is supposed to be "69420"

0

u/ChemistryUnusual5324 Jun 30 '22

id = input("enter your password: ") print(id == 369)

11

u/alexcwarren Jun 30 '22
id = input("enter your password: ")
print(id == "369")

Or you could convert your id input to an integer:

id = int(input("enter your password: "))
print(id == 369)

-3

u/WizardoftheNewAge Jun 30 '22

Try this OP:

Print("Your Id is = "+Id)

1

u/WizardoftheNewAge Jun 30 '22

Or if you want to print a boolean then just add quotes to your print statement for the 369