I am wondering about this if I had a program that contained this:
if (0 <= X and X < 49)
output "you fail"
What will be printed if the input is 0? would it say you fail? I was thinking it was worded wrong and it should read:if (0 <= X or X < 49)
output "you fail"

Recommended Answers

All 4 Replies

if (0 <= x && x < 49) can also be written as if (x >= 0 && x < 49) Now what would you think will happen if x == 0 ?

It would output you fail

Correct. Problem solved I guess or do you have more question?

Thanks, I guess i was just not sure about this stuff.

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.