Ws you can see below, the code above and under the start of loop looks pretty much same. Is it possible to avoid this repetition?
Code:
term = ","
file_name = input("What is the file name? ")
f_extns = file_name.split(".") #splitting file extension from file name
while term in file_name:
print("Please type file name again with . not, ")
file_name = input("What is the file name? ")
f_extns = file_name.split(".")
else:
print("The file extension is: " + repr(f_extns[-1]))