Advertisement
horozov86

Activation Keys

Mar 21st, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. first_line = input()
  2.  
  3. while True:
  4.     line = input()
  5.     if line == "Generate":
  6.         break
  7.  
  8.     line_split = line.split(">>>")
  9.     command = line_split[0]
  10.  
  11.     if command == "Contains":
  12.         substring = line_split[1]
  13.         if substring in first_line:
  14.             print(f"{first_line} contains {substring}")
  15.         else:
  16.             print(f"Substring not found!")
  17.  
  18.     elif command == "Flip":
  19.         current_command = line_split[1]
  20.         start_idx = int(line_split[2])
  21.         end_idx = int(line_split[3])
  22.         if current_command == "Upper":
  23.             first_part = (first_line[:start_idx])
  24.             middle_part = (first_line[start_idx:end_idx]).upper()
  25.             second_part = (first_line[end_idx:])
  26.             first_line = first_part + middle_part + second_part
  27.             print(first_line)
  28.         else:
  29.             first_part = (first_line[:start_idx])
  30.             middle_part = (first_line[start_idx:end_idx]).lower()
  31.             second_part = (first_line[end_idx:])
  32.             first_line = first_part + middle_part + second_part
  33.             print(first_line)
  34.  
  35.     elif command == "Slice":
  36.         start_idx = int(line_split[1])
  37.         end_idx = int(line_split[2])
  38.         first_part = (first_line[:start_idx])
  39.         second_part = (first_line[end_idx:])
  40.         first_line = first_part + second_part
  41.         print(first_line)
  42.  
  43. print(f"Your activation key is: {first_line}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement