I'm having an issue that is probably more easy than I am making it out to be. (I am in an intro level programming class)
Basically I am writing a program where I ask a user for a file name, I read info from the file before sorting it in a list and writing it somewhere else. The assignment wants us to ask user for the file name to read from. If the user enters the file name with the '.txt', we carry on with the processing. If they do not, we must add the '.txt' before continuing on. I know how to add the '.txt' to the file name if they did not include it, but I can not figure out how to check first to see if they did.
How do I go about first checking to see if the user wrote the file name with the extension?
I am assuming it has something to do with an if/else statement but I have been baffled.
Thank you