jackfrued / jackfrued/Python-100-Days

Day4 练习1也可以根据商是否为整数来进行判断

Open
#734 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

number = int(input('请输入一个正整数:'))

if number <= 0:
    print('非正整数!')

elif number == 1:
    print('1既非素数也非合数')

else :
    for x in range(2, number+1):
        r = number / x     
        if r.is_integer() and x != number:        
            print ('%d非素数,可被%d整除' % (number, x))
            break
        else:
            print ('%d是素数' % (number))
            break

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 Day4 Exercise 1 material and inspect how the current prime-number exercise is presented. Compare the suggested quotient-based approach with the existing lesson and examples; done means the exercise consistently reflects the accepted approach and its expected output remains clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
content
Issue type
Feature
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.