when toggling between menu buttons they duplicate tkiniter code example

Example: how to make menu in tkinter

from tkinter import *

def do_some():
    print('Do some!')

root = Tk()

main_menu = Menu(root)
root.config(menu=main_menu)


# Type 1 Menu
main_menu.add_command(label='File', command=do_some)
# Type 1 Menu


# Type 2 Menu
file_menu = Menu(main_menu)
main_menu.add_cascade(label='File', menu=file_menu)

file_menu.add_command(label='Save', command=do_some)
file_menu.add_command(label='Save As', command=do_some)
# Type 2 Menu


# Type 3 Menu
file_menu = Menu(main_menu)
main_menu.add_cascade(label='File', menu=file_menu)

save_menu = Menu(file_menu)
save_as_menu = Menu(file_menu)

file_menu.add_cascade(label='Save', menu=save_menu)
file_menu.add_cascade(label='Save As', menu=save_as_menu)

save_menu.add_command(label='New', command=do_some)
save_menu.add_command(label='Old', command=do_some)
save_as_menu.add_command(label='New', command=do_some)
save_as_menu.add_command(label='Old', command=do_some)
# Type 3 Menu

root.mainloop()