I am very new to programming, and previously I made a basic calculator and it uses code like:
def calculator(): num1 = float(input("Enter first number: ")) oprt = input("Enter an operator(exam: +, -, *, /): ") num2 = float(input("Enter second number: ")) if oprt == "+": print(num1 + num2) elif oprt == "-": print(num1 - num2) elif oprt == "*": print(num1 * num2) elif oprt == "/": print(num1 / num2) else: print("Invalid operator")it works but when I make such a simple choice game with a code like:
def choice_game(): user = input("Enter your name") if user == "Daffa": print("Hello Daffa")it won't work, can anyone tell me why the code doesn't work, whatever I wrote in the code, the code still doesn't work, I've also tried using a try statement