Question

1. Using logical operators modify the following Python "if" statement to print ("AND operator condition worked")?...

1. Using logical operators modify the following Python "if" statement to print ("AND operator condition worked")?

x=2

y=3

if (x<=2 or y>=3) and (x>2 or y<2):

print("AND operator condition worked")

else: print("it doesn't work")

2. Write a program that asks user for five numbers and returns the largest of them. Do not use max function built in python.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

x=2
y=3
if (x<=2 or y>=3):
    print("AND operator condition worked")
else:
    print("it doesn't work")

AND operator condition worked

lst = []
for x in range(5):
    lst.append(eval(input("Enter number "+str(x)+": ")))
maxVal = lst[0]
for x in lst:
    if(maxVal < x):
        maxVal = x
print("Max value =",maxVal)

Add a comment
Know the answer?
Add Answer to:
1. Using logical operators modify the following Python "if" statement to print ("AND operator condition worked")?...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT