subject

I need help converting this to python but i have no idea how to. const tolerance := 0.0000001

function fac (x : real) : real
var answer : real := 1
if x = 0 or x = 1 then
result answer
else

for i : 1 .. round (x)
answer *= i
end for
result answer
end if
end fac

function e : real
var answer1 : real := 0
var answer2 : real := 1
var n : real := 0
loop
exit when abs (answer1 - answer2) <
tolerance
answer2 := answer1
answer1 += 1 / fac (n)
n += 1
end loop
result answer1
end e

put e

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 25.06.2019 08:20
In the following table, column a is column b is and column c is
Answers: 1
question
Computers and Technology, 25.06.2019 09:30
If a business owner wanted to create a banner ad for his business on his webpage, he could use java programming to develop a (n) spreadsheet cad software applet music application
Answers: 1
You know the right answer?
I need help converting this to python but i have no idea how to. const tolerance := 0.0000001
...
Questions
Questions on the website: 13722366