Currently on week 1 of CS50P. I have an else statement that keeps on printing even though the scenario is true, and wondering what I could implement to avoid this problem. I know that I didn't add a proper conditional to it, it has repetitive code, such as if and endswitch as well.
extensions_files = input("File name: ")
extensions_files = extensions_files.replace(" ", "")
if extensions_files.endswith(".jpg"):
print("image/jpg")
if extensions_files.endswith(".jpeg"):
print("image/jpeg")
if extensions_files.endswith(".pdf") or ("PDF"):
print("application/pdf")
if extensions_files.endswith(".png"):
print("image/png")
if extensions_files.endswith(".gif"):
print("image/gif")
if extensions_files.endswith(".txt"):
print("text/plain")
elif extensions_files.endswith(".zip"):
print("application/zip")
else:
print("application/octet-stream")