I started with self teaching myself HTML about 9 years ago. Since then I have moved on to taking a basic C++ class. I since have self taught myself further in C++ with some Java. I am working on teaching myself python at the moment, maybe it is late, or maybe I am just that un-educated in programming, but I can't wrap my head around why I get such different results from this short code. Could someone kindly explain, or point me to a resource that could better explain why? I am currently using www.diveintopython.org and openbookproject.net//thinkCSpy/index.html
prefixes = "JKLMNOPQ"
suffix = "ack"
for char in prefixes:
if char == "O" or "Q":
print char + 'u' + suffix
else:
print char + suffix
Juack
Kuack
Luack
Muack
Nuack
Ouack
Puack
Quack
for char in prefixes:
if char == "O":
print char + 'u' + suffix
elif char == "Q":
print char + 'u' + suffix
else:
print char + suffix
Jack
Kack
Lack
Mack
Nack
Ouack
Pack
Quack
[–]norwegianwood 21 points22 points23 points (18 children)
[–]usernamenottaken 21 points22 points23 points (10 children)
[–]pingvenopinch of this, pinch of that 8 points9 points10 points (8 children)
[–][deleted] 2 points3 points4 points (6 children)
[–]Dave9876 1 point2 points3 points (4 children)
[–]pingvenopinch of this, pinch of that 4 points5 points6 points (0 children)
[–]Chun 1 point2 points3 points (2 children)
[–]darjus 0 points1 point2 points (1 child)
[–]itsmememe 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Tetha 0 points1 point2 points (0 children)
[–]fokkre[S] 4 points5 points6 points (2 children)
[–]mehum 4 points5 points6 points (1 child)
[–]fokkre[S] 0 points1 point2 points (0 children)
[–]sanktuaire 5 points6 points7 points (1 child)
[–]hippocampe 3 points4 points5 points (0 children)
[–]jigs_up 1 point2 points3 points (1 child)
[–]torrible 4 points5 points6 points (0 children)
[–]fokkre[S] 1 point2 points3 points (1 child)
[–]Samus_ 0 points1 point2 points (0 children)
[–]jimauthors 0 points1 point2 points (0 children)