Advertisement
viligen

activation_key

Nov 28th, 2021
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. activation_key = input()
  2.  
  3. while True:
  4.     command = input().split(">>>")
  5.     if command[0] == "Generate":
  6.         break
  7.     elif command[0] == "Contains":
  8.         substring = command[1]
  9.         if substring in activation_key:
  10.             print(f"{activation_key} contains {substring}")
  11.         else:
  12.             print("Substring not found!")
  13.     elif command[0] == "Flip":
  14.         flip_type = command[1]
  15.         start_idx, end_idx = int(command[2]), int(command[3])
  16.         if flip_type == "Upper":
  17.             changed_part = activation_key[start_idx:end_idx].upper()
  18.             activation_key = activation_key[:start_idx] + changed_part + activation_key[end_idx:]
  19.         elif flip_type == "Lower":
  20.             changed_part = activation_key[start_idx:end_idx].lower()
  21.             activation_key = activation_key[:start_idx] + changed_part + activation_key[end_idx:]
  22.         print(activation_key)
  23.     elif command[0] == "Slice":
  24.         start_idx, end_idx = int(command[1]), int(command[2])
  25.         activation_key = activation_key[:start_idx] + activation_key[end_idx:]
  26.         print(activation_key)
  27. print(f"Your activation key is: {activation_key}")
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement