does python have an 'or' sign?

Joined
Dec 29, 2015
Messages
2
Reaction score
0
i'm new to python but I have programmed in JavaScript, in which there is a symbol for 'or'. is there one like that for Python that you would use in an if statement so more than one scenarios would get the same output, without making more than one if statements?
 
Joined
Jan 28, 2016
Messages
5
Reaction score
1
i'm new to python but I have programmed in JavaScript, in which there is a symbol for 'or'. is there one like that for Python that you would use in an if statement so more than one scenarios would get the same output, without making more than one if statements?


yes python do have or conditional statement the code below is a demonstration

mango = 1
apple = 2
if mango == 1 or apple == 2:
print("yea, it worked")
if mango == 1 or apple == 3:
print("it worked twice")

the output from the above will be:

yea it worked
it worked twice

hope this helps.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top