program 7
program 7
def backup_folder_to_zip(folder_path):
# Create a zip file from the folder
shutil.make_archive(folder_path, 'zip', folder_path)
print(f"Folder '{folder_path}' has been backed up successfully!")
# Example usage
folder_to_backup = "C:\\Users\\Ajay C P\\Untitled Folder\\organizingfiles\\lists" # Specify
the folder you want to back up
backup_folder_to_zip(folder_to_backup)
8. '''Write a function named DivExp which takes TWO parameters a, b and returns a value c
(c=a/b). Write suitable assertion for a>0 in function DivExp and raise an exception for
when b=0. Develop a suitable program which reads two values from the console and calls
a function DivExp'''
def DivExp(a, b):
# Check if a is greater than 0
assert a > 0, "a must be greater than 0"
except Exception as e:
# Handle any unexpected exceptions
print(f"Unexpected error: {e}")