simeonshopov

Notifications

Nov 16th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. message_count = int(input())
  2.  
  3.  
  4. def warning_message(operation):
  5.     mess1 = f"Warning: {operation}."
  6.     print(mess1)
  7.     print("=" * len(mess1))
  8.  
  9.  
  10. def error_message(operation, reason, error_code):
  11.     mess1 = f"Error: Failed to execute {operation}."
  12.     mess2 = f"Reason: {reason}."
  13.     mess3 = f"Error code: {error_code}."
  14.     print(mess1)
  15.     print("=" * len(mess1))
  16.     print(mess2)
  17.     print(mess3)
  18.  
  19.  
  20. def success_message(operation, mess):
  21.     mess1 = f"Successfully execuded {operation}."
  22.     mess2 = f"{mess}."
  23.     print(mess1)
  24.     print("=" * len(mess1))
  25.     print(mess2)
  26.  
  27.  
  28. def read_and_process(count):
  29.     for i in range(count):
  30.         mess = input()
  31.         if mess == "error":
  32.             operation = input()
  33.             reason = input()
  34.             error_code = input()
  35.             error_message(operation, reason, error_code)
  36.         elif mess == "warning":
  37.             operation = input()
  38.             warning_message(operation)
  39.         elif mess == "success":
  40.             operation = input()
  41.             mess = input()
  42.             success_message(operation, mess)
  43.         print()
  44.  
  45.  
  46. read_and_process(message_count)
Advertisement
Add Comment
Please, Sign In to add comment