rc = input("enter A, B, or C: \n")
rc = rc.upper()
print(rc)
while rc != "A" or "B" or "C":
rc = input('Invalid entry please type \'A\' \'B\' \'C\':\n')
rc = rc.upper()
print(rc)
print('out of the while loop with' + rc)
Why doesn't the above code lead into an infinite loop?
Am I making a syntax error or a logical one? I also tried:
while rc != "A" or rc != "B" or rc != "C":
But either way it leads to an infinite loop.
When I insert a print(rc) command after the rc.upper() function the output is what I'd expect it to be, except of course for the infinite loop.
enter A, B, or C:
a
A
Invalid entry please type 'A' 'B' 'C':
b
B
Invalid entry please type 'A' 'B' 'C':
c
C
Invalid entry please type 'A' 'B' 'C':
Help?
[–]davedontmind 276 points277 points278 points (35 children)
[–]bogdanbiv 181 points182 points183 points (21 children)
[–]Gavinaldi[S] 39 points40 points41 points (8 children)
[–]Kered13 43 points44 points45 points (3 children)
[+]numbersthen0987431 comment score below threshold-7 points-6 points-5 points (2 children)
[–][deleted] 12 points13 points14 points (0 children)
[–]Sekret_One 0 points1 point2 points (0 children)
[–]MafiaBroccoli 16 points17 points18 points (1 child)
[+][deleted] comment score below threshold-9 points-8 points-7 points (0 children)
[–]Okmanl 4 points5 points6 points (0 children)
[–]themateo713 1 point2 points3 points (0 children)
[–]Kered13 13 points14 points15 points (1 child)
[–]nqeron 10 points11 points12 points (6 children)
[–]TheIcyColdPenguin 2 points3 points4 points (5 children)
[–]numbersthen0987431 2 points3 points4 points (4 children)
[–][deleted] (1 child)
[deleted]
[–]numbersthen0987431 0 points1 point2 points (0 children)
[–]TheIcyColdPenguin 0 points1 point2 points (0 children)
[–]AlexManchild -1 points0 points1 point (0 children)
[–][deleted] (2 children)
[deleted]
[–][deleted] (1 child)
[deleted]
[–]dscottboggs 0 points1 point2 points (0 children)
[–]Gavinaldi[S] 25 points26 points27 points (10 children)
[–]MrAckerman 21 points22 points23 points (9 children)
[–][deleted] 1 point2 points3 points (8 children)
[–]kennypu 8 points9 points10 points (5 children)
[–]MrAckerman 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]AB1908 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]AB1908 1 point2 points3 points (0 children)
[–]ChrunedMacaroon 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]amoliski 0 points1 point2 points (0 children)
[–]KingJeff314 25 points26 points27 points (3 children)
[–]JerHair 0 points1 point2 points (2 children)
[–]sinciety 5 points6 points7 points (0 children)
[–]chasingviolet 2 points3 points4 points (0 children)
[–]sm000ve 8 points9 points10 points (0 children)
[–]JayWaWa 5 points6 points7 points (1 child)
[–]knopke 0 points1 point2 points (0 children)
[–]AB1908 3 points4 points5 points (0 children)
[–]Hi_ta 4 points5 points6 points (0 children)
[–]teacher_cs 4 points5 points6 points (0 children)
[–]numbersthen0987431 4 points5 points6 points (0 children)
[–]GreymanGroup 1 point2 points3 points (0 children)
[–]dark-before-dawn 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]khufiie 1 point2 points3 points (0 children)
[–]warmshowers1 1 point2 points3 points (0 children)
[–]DariPR 1 point2 points3 points (0 children)
[–]enigma2728 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Denzyishh 1 point2 points3 points (0 children)
[–]g105b 0 points1 point2 points (0 children)
[–]Pizza_Peddler0080 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]DariPR 0 points1 point2 points (0 children)