Hello,

This if statement is always returning true and I cannot see why. Could you guys tell me why?

menu = input("Choose what you would like to do:\n\n1. Work out how far you will travel with a set time and speed\n2. Work out the speed you will need to travel to do a certain distance in a specific time.\nChoice: ")
if(int(menu) != 1 or int(menu) != 2):
    print("Error. Enter 1 or 2.")
    menu = input("Choose what you would like to do:\n\n1. Work out how far you will travel with a set time and speed\n2. Work out the speed you will need to travel to do a certain distance in a specific time.\nChoice: ")

Because for every number n the following is true:
n!=1 or n!=2

Clear thinking?

commented: Thanks mate :) +4
commented: indeed +14

As an exercise please deny the following statement:
There is a moment is every woman's life, when she wants to do something forbidden.

Just joking.

You wanted to write: n!=1 and n!=2

There is a moment is every woman's life, when she wants to do something forbidden.

Easy, the opposite is: Some women never want to do anything forbidden.

Another solution was

if int(menu) not in (1, 2):
commented: I didn't know you could do that even when I knew python well. Thank you :). +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.