0

I'm learning how to code and to start i want crate a command that when i write "Dio" for example it writes me "Error 404: dio non esiste" but it says that the code is wrong, what am i doing wrong? here's the code

name = int(input("Come ti chiami? "))
if name is "Antonio":
    print("Eh no")
if name is "Dio":
    print("Error 404: Dio non esiste")
if name is "Dio porco":
    print("lol")
ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Desk2005
  • 3
  • 1

2 Answers2

1

You have taken input of type int:

Instead just take :

name = input("Come ti chiami? ")

which would be string by default, and use "==" to compare.

But if you have just started learning, I would suggest first go through the python documentation which would give you a basic understanding of how to write python codes.

Sadiq Raza
  • 334
  • 1
  • 3
  • 10
0

is checks if two values are exactly the same reference. Since you're inputting one value from a user and the other is hard coded, they won't be the same reference. Instead, you should use the == operator. Additionally, if you're inputting a name, you shouldn't convert the input to an int:

name = input("Come ti chiami? ")
if name == "Antonio":
    print("Eh no")
if name == "Dio":
    print("Error 404: Dio non esiste")
if name == "Dio porco":
    print("lol")
Mureinik
  • 297,002
  • 52
  • 306
  • 350