'If statement issue with basic python program [python]

I a new in programming , was trying some concepts with if else in python
The if else statement is not working as it should.
I'm using nested if-else , however only included the basic code in the code block
I am using a string as an input and then comparing the input with if else statements.
I tried the code in Thonny ide and it works when I debug the program , but after trying to run the program it does not print anything .
Alternatively if I use an else statement instead of the elif in the end , only the code in the else statement will print



the code is :

new_value = input("enter your choice between left and right")

if new_value =='left':
 print("You chose left")
elif new_value =="right":
 print("you chose right")



Solution 1:[1]

This code is correct.

new_value = input("enter your choice between left and right")
if new_value =="left":
 print("You chose left")
elif new_value =="right":
 print("you chose right")

Alternatively if you use an else statement reffer it,

if new_value =='left':
 print("You chose left")
else:
 print("you chose right")

provide your full nested loop so i will understand problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shubh Patel