Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- first_line = input()
- while True:
- line = input()
- if line == "Generate":
- break
- line_split = line.split(">>>")
- command = line_split[0]
- if command == "Contains":
- substring = line_split[1]
- if substring in first_line:
- print(f"{first_line} contains {substring}")
- else:
- print(f"Substring not found!")
- elif command == "Flip":
- current_command = line_split[1]
- start_idx = int(line_split[2])
- end_idx = int(line_split[3])
- if current_command == "Upper":
- first_part = (first_line[:start_idx])
- middle_part = (first_line[start_idx:end_idx]).upper()
- second_part = (first_line[end_idx:])
- first_line = first_part + middle_part + second_part
- print(first_line)
- else:
- first_part = (first_line[:start_idx])
- middle_part = (first_line[start_idx:end_idx]).lower()
- second_part = (first_line[end_idx:])
- first_line = first_part + middle_part + second_part
- print(first_line)
- elif command == "Slice":
- start_idx = int(line_split[1])
- end_idx = int(line_split[2])
- first_part = (first_line[:start_idx])
- second_part = (first_line[end_idx:])
- first_line = first_part + second_part
- print(first_line)
- print(f"Your activation key is: {first_line}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement