Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://judge.softuni.org/Contests/Practice/Index/2302#0
- 05. Programming Fundamentals Final Exam
- 01. Activation Keys
- raw_key = input()
- while True:
- command = input().split(">>>")
- if command[0] == 'Generate':
- print(f"Your activation key is: {raw_key}")
- break
- elif command[0] == 'Flip':
- if command[1] == 'Upper':
- start_index = int(command[2])
- end_index = int(command[3])
- raw_key = raw_key[:start_index] + raw_key[start_index:end_index].upper() + raw_key[end_index:]
- print(raw_key)
- elif command[1] == 'Lower':
- start_index = int(command[2])
- end_index = int(command[3])
- raw_key = raw_key[:start_index] + raw_key[start_index:end_index].lower() + raw_key[end_index:]
- print(raw_key)
- elif command[0] == 'Slice':
- start_index = int(command[1])
- end_index = int(command[2])
- raw_key = raw_key[:start_index] + raw_key[end_index:]
- print(raw_key)
- elif command[0] == 'Contains':
- substring = command[1]
- if substring in raw_key:
- print(f'"{raw_key} contains {substring}')
- else:
- print("Substring not found!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement