Write a function named ask_file_name that repeatedly prompts the user for a file name until the user types the name of a file that exists on the system. Once you get a good file name, return that filename as a String.
this is what I have done till now:
import os.path
def ask_file_name():
file = input("Type a file name: ")
x = os.path.exists(file)
if x :
return file
else:
ask_file_name()
but it is giving the following error: expected string, but no value was returned