Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: realpython/python-basics-exercises
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fe1ec67
Choose a base ref
...
head repository: realpython/python-basics-exercises
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9f8732f
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 7, 2023

  1. Copy the full SHA
    9f8732f View commit details
Showing with 12 additions and 0 deletions.
  1. +12 −0 ch08-conditional-logic/4-challenge-find-the-factors-of-a-number.py
12 changes: 12 additions & 0 deletions ch08-conditional-logic/4-challenge-find-the-factors-of-a-number.py
Original file line number Diff line number Diff line change
@@ -8,3 +8,15 @@
for divisor in range(1, num + 1):
if num % divisor == 0:
print(f"{divisor} is a factor of {num}")


# Check whether the user inputs the number "3"

print("I'm thinking of a number between 1 and 10. Guess which one.")

number = input()

if number == "3":
print("You win!")
else:
print("You lose.")