Hello.
I understand the conversation. I've been following Python Hoemun on the internet, and number one works well.
I made number 2 and copied it.False, false, false, false. It comes out five times. (A month-old beginner of Python Wang asks a question. nodding ). Replace #2 well. ㅜ.ㅜ
).).1. word = input('Enter a word:')
is_palindrome = True
for i in range(len(word) // 2):
if word[i] != word[-1 - i]:
is_palindrome = False
break
print(is_palindrome)
2. words = ['big', 'level', 'levpel', 'pson', 'level']
is_palindrome = True
for word in words:
for i in range(len(word) // 2):
if word[i] != word[-1 - i]:
is_palindrome = False
break
print(is_palindrome)
Move the is_palindrome = True part to the logic below for word in words: This is a problem caused by the bullion not being initialized.
© 2024 OneMinuteCode. All rights reserved.