Advertisement
xi_arma

Untitled

Aug 18th, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. def check_sets(set_A, set_B):
  2.     if set_A == set_B:
  3.         return "Both sets are equal."
  4.     elif len(set_A) == len(set_B):
  5.         return "Both sets are not equal but equivalent."
  6.     else:
  7.         return "Both sets are not equal and equivalent."
  8.  
  9. def input_value_set(prompt):
  10.     while True:
  11.         values = input(prompt).split()
  12.         if len(values) > 5:
  13.             print("Maximum is 5 elements! Please try again.")
  14.         else:
  15.             return set(map(int, values))
  16.            
  17. set_A = input_value_set("Enter SET A values: ")
  18. set_B = input_value_set("Enter SET B values: ")
  19.  
  20. print(f"""
  21. A = {set_A}
  22. B = {set_B}
  23.  
  24. {check_sets(set_A, set_B)}
  25. """)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement