Tuesday, July 22, 2025

WTP in python - Traffic Light Simulator

 # Traffic Light Simulator

# Input a color (red, yellow, green) and print the corresponding action:


# Red → Stop

# Yellow → Get Ready

# Green → Go


light_type=input("Please enter the light type (red, yellow, green ) : ")



if(light_type=="red"):

    print("Stop")

elif(light_type=="yellow"):

    print("Get Ready")

elif(light_type=="green"):

    print("Go")

else:

    print("wrong input")

No comments:

Post a Comment