Constructive criticism EX15 input function

hey guys, wrote out this code and would like some feedback, on how I could improve the code or simplify it ect.

I have stopped at ex15 and ex16 currently as I wanted to be able to write both codes my way without looking at zeds work.

print("Welcome user, please insert filename you would like to execute.")
filename = input("> ")

file_open = (open(filename))


print("Would you like to delete your file?")
print("If you DO NOT want to delete press 'CTRL-Z'")
print("If you DO want to delete it, insert filename below ")
filename_1 = input("> ")
filename_2 = open(filename_1, 'w')
print("Deleting the file...")
print("File deleted")

print("Lets add some notes to the file (MAX 3 LINES)")
line_1 = input("Line 1: ")
line_2 = input("Line 2: ")
line_3 = input("Line 3: ")

print("Adding lines to file '{}' now...".format(filename_1))



print("Lets run the file again.")
file_new = input("Insert file name: ")

file_print = open(file_new)


Hi @Kamiownz your code looks fine to me. I think you can pick up the next exercises.

That looks good except for:

file_open = (open(filename))

Don’t put the parens around the open call like that. That’ll cause you a world of pain later if you’re tossing parens around random things. If you ever get data and it seems like it’s suddenly a list and looks like it’s got parens around it when you print it, then it’s because you did this and that turned it into a tuple.

Do this instead:

file_open = open(filename)

Wicked, thanks for your reply Zed.

I’ll make that correction now.