about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--calc_position.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/calc_position.py b/calc_position.py
index e2c19d0..daa819d 100644
--- a/calc_position.py
+++ b/calc_position.py
@@ -1,6 +1,16 @@
+import re
 
+with open("pi_million", "r") as f:
+    text = f.read()
 
-i = int(input("Enter position: "))
+number = int(input("Search for: "))
+
+match = re.search(rf"{number}", text)
+
+if match:
+    i = int(match.start(0)) + 1
+else:
+    print("Number could not be found")
 
 num_rows = 46
 num_cols = 52