How to structure multiple *or* function in python. Ex Input 1-36 If input == 2 or 4 or 6 Display even Else if input == 1 or 3 or 5 Display odd Some reason all of the numbers come back as true so odd doesn't show when input is 1, 3, 5
How to structure multiple *or* function in python. Ex Input 1-36 If input == 2 or 4 or 6 Display even Else if input == 1 or 3 or 5 Display odd Some reason all of the numbers come back as true so odd doesn't show when input is 1, 3, 5
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
How to structure multiple *or* function in python.
Ex
Input 1-36
If input == 2 or 4 or 6
Display even
Else if input == 1 or 3 or 5
Display odd
Some reason all of the numbers come back as true so odd doesn't show when input is 1, 3, 5
Expert Solution

Explanation
Here I have taken input from the user and stored it in a variable.
Next, I have used a conditional statement to check whether the input is even or odd.
In the conditional statement, I have used the "or" keyword to separate 3 sub-conditions.
When the conditional block turns to be true and the program pointer goes inside the block, I have used the print statement to display the message on the console.
Step by step
Solved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education