0

I wrote that code in python but it only shows 2 tasks right and not all how can I solve it?

#Here is the Python code to find the Nth decimal digit of Pi: import math def nth_digit_of_pi(n): pi = str(math.pi) pi = pi.replace('.', '') return int(pi[n]) n = int(input()) print(nth_digit_of_pi(n)) #This code uses the math module to get the value of Pi, converts it to a string, removes the decimal point, and then returns the Nth digit.

23rd Jan 2025, 10:44 AM
Manish Kumar
Manish Kumar - avatar
2 Antworten
+ 3
print out the pi value that math module uses. count the number of decimals of this pi value. what do you observe? compare to the task instruction.
23rd Jan 2025, 12:02 PM
Lisa
Lisa - avatar
0
This works only 15 digits decimals with accuracy.
23rd Jan 2025, 2:54 PM
Manish Kumar
Manish Kumar - avatar