Sarma: thank you so much, I checked your code, it works. However, can you enlighten me what it exactly does? I do not understand it (yet). Thank you in advance.
file_path = "C:/Users/Rafael/PythonCode/PiDigits.txt" with open (file_path) as a: b = a.read() get_year = input("What year were you born? ") count = 0 b = "3"+b[2:] n = len(b) for i in range(n-3): if b[i:i+4] == get_year: count += 1 print("Your birth date occurs %s times in PI!" % (count)) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor