Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1
- print("Conditions: line length >= 3")
- s = input("Enter line: ")
- n = len(s)
- while (n < 3):
- print("ERROR: line length too short ")
- print("Enter line again: ")
- s = input("Enter line: ")
- n = len(s)
- print(f"Result: {s[n-3:]}")
- #2
- s = input("Enter line: ")
- n = len(s)
- new_s = ""
- for i in range(n):
- if (s[i].isalpha()):
- new_s += s[i]
- print(f"Result: {new_s}")
- #3
- s = input("Enter line: ")
- a = s.split(' ')
- print(a)
- for i in range(len(a)):
- print(f"Word {i+1}: {a[i]}")
Add Comment
Please, Sign In to add comment