I am a beginner Python learner. This keeps looping and I couldn't seem to find the error in this to get it corrected. Any help would be appreciated. Thanks.
sentence = "that car was really fast"
i = 1
while i > 0:
for char in sentence:
if char == "t":
print("found a 't' in sentence")
else:
print("maybe the next character?")
I think what you want is to print 'found t in sentence' if the char is a 't' and else print 'maybe the next character?'. You should not use the
whileloop in this program onlyforloop will suffice what you are trying to do.