Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions book/2e/02.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ Interpreted Script

def factorial(x):
result = 1
for i in xrange(2, x + 1):
for i in range(2, x + 1):
result *= i
return result

if __name__ == "__main__":
import sys
x = int(sys.argv[1])
print factorial(x)
print(factorial(x))
```

This script computes the factorial of the integer that we pass as a parameter. It can be invoked from the command line as follows:
Expand Down
4 changes: 2 additions & 2 deletions book/2e/data/ch02/fac.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

def factorial(x):
result = 1
for i in xrange(2, x + 1):
for i in range(2, x + 1):
result *= i
return result

if __name__ == "__main__":
import sys
x = int(sys.argv[1])
print factorial(x)
print(factorial(x))