selfteaching / selfteaching/selfteaching-python-camp

Day04 用while循环加条件去除偶数的问题

Open
#2,069 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

f = 1
while f <= 9:
     h = 1
     while h < f + 1:
          if f%2==0:
               break

          print(f, "*", h, '=', f*h, sep='', end='\t')

          h += 1
     print()
     f += 1

上面是代码
下面是输出结果
@@但是结果当中有空行,自己百度没解决,,

1*1=1	

3*1=3	3*2=6	3*3=9	

5*1=5	5*2=10	5*3=15	5*4=20	5*5=25	

7*1=7	7*2=14	7*3=21	7*4=28	7*5=35	7*6=42	7*7=49	

9*1=9	9*2=18	9*3=27	9*4=36	9*5=45	9*6=54	9*7=63	9*8=72	9*9=81

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

Run the Python snippet and inspect the control flow around the inner while loop, the break, and the following print() call. Done means the even-number rows are omitted without producing unintended blank lines, while the odd-number multiplication output remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
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.