Untitled
unknown
plain_text
2 years ago
464 B
3
Indexable
Never
#!/usr/bin/python3 BDAY_NOT_FOUND = -1 # find() starts at 0, not 1 IDX_OFFSET = 1 READ_ONLY = 'r' # read pi into a string with open('pi.txt', READ_ONLY) as fd: data = fd.read().rstrip() digits = int(input("How many digits: ")) bday = input("Enter bday [mmddyyyy]: ") pos = data.find(bday) + IDX_OFFSET if (pos == BDAY_NOT_FOUND): print("Your bday can not be found") else: print(f"Your birthday is located at position {pos} of pi")