Skip to content

Commit 2061cd6

Browse files
author
deepshekhardas
committed
fix: replace conditional expression with explicit if/else for ruff compatibility
1 parent f7d48aa commit 2061cd6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

strings/zigzag_conversion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def zigzag_convert(s: str, num_rows: int) -> str:
3838
rows[current_row].append(char)
3939
if current_row == 0 or current_row == num_rows - 1:
4040
going_down = not going_down
41-
current_row += 1 if going_down else -1
41+
if going_down:
42+
current_row += 1
43+
else:
44+
current_row -= 1
4245

4346
return "".join("".join(row) for row in rows)
4447

0 commit comments

Comments
 (0)