mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Improved readability (#1615)
* improved readability * further readability improvements * removed csv file and added f
This commit is contained in:

committed by
Christian Clauss

parent
938dd0bbb5
commit
9eb50cc223
@ -19,7 +19,7 @@ def ucal(u, p):
|
||||
|
||||
|
||||
def main():
|
||||
n = int(input("enter the numbers of values"))
|
||||
n = int(input("enter the numbers of values: "))
|
||||
y = []
|
||||
for i in range(n):
|
||||
y.append([])
|
||||
@ -28,14 +28,14 @@ def main():
|
||||
y[i].append(j)
|
||||
y[i][j] = 0
|
||||
|
||||
print("enter the values of parameters in a list")
|
||||
print("enter the values of parameters in a list: ")
|
||||
x = list(map(int, input().split()))
|
||||
|
||||
print("enter the values of corresponding parameters")
|
||||
print("enter the values of corresponding parameters: ")
|
||||
for i in range(n):
|
||||
y[i][0] = float(input())
|
||||
|
||||
value = int(input("enter the value to interpolate"))
|
||||
value = int(input("enter the value to interpolate: "))
|
||||
u = (value - x[0]) / (x[1] - x[0])
|
||||
|
||||
# for calculating forward difference table
|
||||
@ -48,7 +48,7 @@ def main():
|
||||
for i in range(1, n):
|
||||
summ += (ucal(u, i) * y[0][i]) / math.factorial(i)
|
||||
|
||||
print("the value at {} is {}".format(value, summ))
|
||||
print(f"the value at {value} is {summ}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user