Post
Python
How can I make a while loop with multiple conditions in Python?
Posted on 26th April 2024
You can use or and and to make a while loop with multiple conditions like this
Using and:
A = 3
B = 4
While A<4 and B<5:
A+=1
B-=1
print(A,B)
Output:
2,3
Using or:
A = 2
B = 2
While A < 5 or B > 3:
A += 1
B -= 1
print(A, B)
Output:
3 1
4 0
STILL GOT QUERIES?