Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int function for the "how_many" variable in line 24 #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion intro-python/part2/fortune_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def generate_fortune() -> str:
def generate_lucky_numbers(how_many: int) -> list:
Copy link
Collaborator

@annegentle annegentle Sep 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the how_many : int in this line is what transforms how_many into an int so I'm surprised that it's necessary again in line 24. Did something change in the Python syntax perhaps?

"""Returns a list of (random) 'lucky' numbers."""
lucky_numbers = []
for _ in range(how_many):
for _ in range(int(how_many)):
lucky_numbers.append(random.randint(0, 99))
return lucky_numbers

Expand Down