Skip to content

Commit 1b69496

Browse files
committed
-1 from length to avoid edge case overflow
1 parent e6ff3da commit 1b69496

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

joke.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def getJoke():
77
# return a random joke loaded from the data.json
88
with open('data.json') as data_file:
99
data = json.load(data_file)
10-
return data[randint(0, len(data))]
10+
return data[randint(0, len(data) - 1)]

0 commit comments

Comments
 (0)