Avatar ·

Problem "Palindrome". Python

📁 string, Advanced Python Topics, example

Problem: Given a string, determine whether it is a palindrome (i.e., whether it reads the same forwards and backwards).

Input The input is a string without spaces. The length of the string does not exceed 200. Letters of different cases are considered different.

Output You need to output yes if the string is a palindrome, and no otherwise.

Example:

abba yes

qwerq no

slovo = str(input())x = len(slovo)i = 0x = x - 1k = 0while x - i >= i:    if slovo[x - i] ==                    
Avatar ·

In the loop

for row_v in range(6):

You are simultaneously incrementing the x coordinate and the y coordinate

x_v_0 += widthy_v_0 += heightx_v_1 += widthy_v_1 += height

But you need to treat such a wall as a two-dimensional array, i.e., first we go through the first row and draw vertical lines, while the y coordinate does not change, only the x coordinate changes. When moving to the next row, y increases, and x resets to zero. At the same time, to get a truly similar brick wall, you need to through st

Log in to leave an answer

Blogs