jackfrued / jackfrued/Python-100-Days

D4打印各种三角形代码是否可以简化

Open
#267 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

python小白代码不规范,如有问题请多多指教

row = int(input('请输入圣诞树的行数:'))

打印第一个三角形

for i in range(1, row + 1):
print('*' * i)

打印第二个三角形

for i in range(1, row + 1):
print(' '* (row - i), '*' * i)

打印第三个三角形

for i in range(1, row + 1):
print(' ' * (row - i), '*' * (2 * i - 1))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Python snippet in the issue and run it with several row values to observe the three triangle outputs. Compare the repeated loops and identify whether they can be simplified without changing the displayed shapes. Done means a clearer equivalent implementation, but the issue does not name a repository file or test to update.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.