Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rle_mode(): #Decompresses user entered data
- abc = 1
- while abc == 1:
- try:#Catches errors
- linecount = int(input("How many lines of compressed data do you want to enter?"))#Inputs compressed data
- if linecount < 1000000000:
- abc = 0
- except ValueError:
- print("Please enter a number greater than 3")
- abc = 1
- while linecount < 3:
- abc = 1
- while abc == 1:
- try:
- linecount = int(input("Please enter a number greater than 3\nHow many lines of compressed data do you want to enter?"))
- if linecount < 1000000000:
- abc = 0
- except ValueError:
- abc = 1
- rle = []
- abcd = 1
- while abcd == 1:
- try:
- rle = []
- for i in range(0,linecount):
- rle.append(input("Please enter your compressed data, line by line: "))
- for i in range(0,len(rle)):
- for x in range(0, len(rle[i]), 3):
- print(int(rle[i][x:x+2]) * rle[i][x+2], end="")#Decompresses data
- abcd = 0
- print()
- except (IndexError, ValueError):
- print("Try again")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement