<jupyter_start><jupyter_text>PRACTICE PROBLEMS ON STRING & LIST**[MUST MAINTAIN VARIABLE NAMING CONVENTIONS FOR ALL THE TASKS]****[Solve all the tasks sequentially]**  Task 1Write a python program that will take a number as an input and check whether the number is Awesome or not. If the number is Awesome, it prints True. Otherwise False.**Awesome number**: a number where every digit is less than its immediate left digit is called an Awesome number. A single-digit number cannot be an awesome number(e.g. 5421 is an Awesome number.)==========================================================**Sample Input1:**\976321\**Sample Output1:**\True==========================================================**Sample Input2:**\9766321\**Sample Output2:**\False==========================================================**Sample Input3:**\9\**Sample Output3:**\False==========================================================**Sample Input4:**\78\**Sample Output4:**\False==========================================================**Sample Input5:**\87\**Sample Output4:**\True<jupyter_code>str1 = input("Enter a number: ")
dup = None
flag = True
count = 0
if len(str1) <= 1:
    flag = False
else:
    for i in str1:
        i = int(i)
        if count == 0:
            dup = i
        elif i < dup:
            dup = i
        else:
            flag = False
            break
        count += 1
print(flag)<jupyter_output><empty_output><jupyter_text>Task 2Write a python program that will take a number a list of numbers(integer) as an input from the user and print whether the number is Awesome or not. ==========================================================**Sample Input1:**\[976321, 321, 9763221, 9742, 876, 3211]\**Sample Output1:**\976321 is an awesome number.\321 is an awesome number.\9763221 is a not-so-awesome number.\9742 is an awesome number.\876 is an awesome number.\3211 is a not-so-awesome number.==========================================================**Sample Input2:**\[97821, 97210, 979210]\**Sample Output2:**\97821 is a not-so-awesome number.\97210 is an awesome number.\979210 is a not-so-awesome number.<jupyter_code>lst1 = input("Enter a list: ")
lst1 = lst1[1:-1]
lst1 = lst1.split(", ")
for k in lst1:
    str1 = str(k)
    dup = None
    flag = True
    count = 0
    if len(str1) <= 1:
        flag = False
    else:
        for i in str1:
            i = int(i)
            if count == 0:
                dup = i
            elif i < dup:
                dup = i
            else:
                flag = False
                break
            count += 1
    if flag:
        print(str1,"is an awesome number.")
    else:
        print(str1,"is a not-so-awesome number.")<jupyter_output>Enter a list: [976321, 321, 9763221, 9742, 876, 3211]
976321 is an awesome number.
321 is an awesome number.
9763221 is a not-so-awesome number.
9742 is an awesome number.
876 is an awesome number.
3211 is a not-so-awesome number.<jupyter_text>Task 3Write a python program that will take a string as input from the user where each number is separated by a comma. Then gets the numbers from the given string and removes all extra spaces. Stores the clean numbers in a list and prints it.**Hints:** For obtaining the numbers from the string, use split(). For cleaning the data, use strip().==========================================================**Sample Input1:**\"97821, 1 &nbsp;&nbsp;&nbsp;  , 97210,&nbsp;&nbsp; 963, &nbsp;&nbsp;&nbsp;979210 , 979210 "\**Sample Output1:**\Data after cleaning: [97821, 1, 97210, 963, 979210, 979210]\==========================================================**Sample Input2:**\"976321, 321&nbsp;&nbsp;,&nbsp;&nbsp;&nbsp;9763221, &nbsp;&nbsp;&nbsp;9742, 876,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3211"\**Sample Output2:**\Data after cleaning: [976321, 321, 9763221, 9742, 876, 3211]==========================================================**Sample Input3:**\"976321, 321 ,&nbsp;&nbsp;&nbsp; 9763221, 9742, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;876, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3211, 976321&nbsp;&nbsp;&nbsp;&nbsp;, 9742"\**Sample Output3:**\Data after cleaning: [976321, 321, 9763221, 9742, 876, 3211, 976321, 9742]<jupyter_code>lst1 = input("Enter a list: ")
lst1 = lst1[1:-1]
lst1 = lst1.split(", ")
final = []
for i in lst1:
    i = i.strip()
    i = int(i)
    final.append(i)
print("Data after cleaning:",final)<jupyter_output>Enter a list: "976321, 321 ,    9763221, 9742,      876,       3211, 976321    , 9742"
Data after cleaning: [976321, 321, 9763221, 9742, 876, 3211, 976321, 9742]<jupyter_text>Task 4Write a python program that will take a list of numbers(integer) as an input from the user and does the following.* counts the number of valid, invalid, and duplicate numbers and prints these to the user.* stores the valid and invalid numbers in a list format and prints these to the user. You need to make sure that a number is stored only Once. **Valid numbers:** A number with a minimum length of 4 and a maximum length of 6 is considered to be valid for this assignment.* Calculate and print the percentage of valid numbers, invalid numbers, and duplicate numbers to the user. **Hints:** Use membership operator in and not in for checking the duplicates. For calculating the percentage, count the numbers of a particular number type.==================================================**Sample Input1:**\[97821, 1, 97210, 963, 979210, 979210]\**Sample Output1:**\================================================\Total numbers present in the given string: 6\Valid number count: 3\Valid numbers in list: [97821, 97210, 979210]\Invalid number count: 2\Invalid numbers in list: [1, 963]\Duplicate number count: 1\================================================\Valid number percentage(%): 50.0\Invalid number percentage(%): 33.333333333333336\Duplicate number percentage(%): 16.666666666666668\================================================\**Sample Input2:**\[976321, 321, 9763221, 9742, 876, 3211]\**Sample Output2:**\================================================\Total numbers present in the given string: 6\Valid number count: 3\Valid numbers in list: [976321, 9742, 3211]\Invalid number count: 3\Invalid numbers in list: [321, 9763221, 876]\Duplicate number count: 0\================================================\Valid number percentage(%): 50.0\Invalid number percentage(%): 50.0\Duplicate number percentage(%): 0.0\================================================\**Sample Input3:**\[976321, 321, 9763221, 9742, 876, 3211, 976321, 9742]\**Sample Output3:**\================================================\Total numbers present in the given string: 8\Valid number count: 3\Valid numbers in list: [976321, 9742, 3211]\Invalid number count: 3\Invalid numbers in list: [321, 9763221, 876]\Duplicate number count: 2\================================================\Valid number percentage(%): 37.5\Invalid number percentage(%): 37.5\Duplicate number percentage(%): 25.0\================================================\<jupyter_code>lst1 = input("Enter a list: ")
lst1 = lst1[1:-1]
lst1 = lst1.split(", ")
vfinal = []
vcount = 0
invfinal = []
invcount = 0
dupcount = 0
dup = []
for k in lst1:
    i = int(k)
    if len(k) >= 4 and len(k) <= 6 and i not in dup:
        vfinal.append(i)
        vcount += 1
    if len(k) < 4 or  len(k) > 6 and i not in dup:
        invfinal.append(i)
        invcount += 1
    if i in dup:
        dupcount += 1
    if i not in dup:
        dup.append(i)
print("================================================")
print("Total numbers present in the given string:",len(lst1))
print("Valid number count:",vcount)
print("Valid numbers in list:",vfinal)
print("Invalid number count:",invcount)
print("Invalid numbers in list:",invfinal)
print("Duplicate number count:",dupcount)
print("================================================")
print("Valid number percentage(%):",(vcount/len(lst1))*100)
print("Invalid number percentage(%):",(invcount/len(lst1))*100)
print("Duplicate number percentage(%):",(dupcount/len(lst1))*100)
print("================================================")<jupyter_output>Enter a list: [97821, 1, 97210, 963, 979210, 979210]
================================================
Total numbers present in the given string: 6
Valid number count: 3
Valid numbers in list: [97821, 97210, 979210]
Invalid number count: 2
Invalid numbers in list: [1, 963]
Duplicate number count: 1
================================================
Valid number percentage(%): 50.0
Invalid number percentage(%): 33.33333333333333
Duplicate number percentage(%): 16.666666666666664
================================================<jupyter_text>Task 5Write a python program that will take a list of numbers(integer) as an input from the user. Then stores the valid numbers, the sum of digits, and multiplication of the digits for each valid number in a list where each number is the 1st element of the list, the sum of digits is the 2nd element of the list and the multiplication of digits is the 3rd element of the list. Finally, print the nested list to the user. **Sample Input1:**\[97821, 97210, 979210]\**Sample Output1:**\Data [number, sum of digits, product of digits]: [[97821, 27, 1008], [97210, 19, 0], [979210, 28, 0]]================================================**Sample Input2:**\[976321, 9742, 3211, 30987]\**Sample Output2:**\Data [number, sum of digits, product of digits]: [[976321, 28, 2268], [9742, 22, 504], [3211, 7, 6], [30987, 27, 0]]================================================**Sample Input3:**\[976321, 9640, 3211]\**Sample Output3:**\Data [number, sum of digits, product of digits]: [[976321, 28, 2268], [9640, 19, 0], [3211, 7, 6]]================================================<jupyter_code>lst1 = input("Enter a list: ")
lst1 = lst1[1:-1]
lst1 = lst1.split(", ")
final = []
sum1 = 0
product = 1
for i in lst1:
    num = int(i)
    for k in i:
        sum1 += int(k)
        product = int(k) * product
    final.append([num,sum1,product])
    sum1 = 0
    product = 1
print("Data",final)<jupyter_output>Enter a list: [976321, 9742, 3211, 30987]
Data [[976321, 28, 2268], [9742, 22, 504], [3211, 7, 6], [30987, 27, 0]]<jupyter_text>Task 6 (Merger of Task1-Task5)Write a python program that will take a string as input from the user where each number is separated by a comma. The numbers must have a minimum length of 4 and a maximum length of 6 to be considered valid for this assignment. Then, you need to complete the following. * Part1: get the numbers from the given string, remove all extra spaces. (clean the data). Print the clean data to the user.* Part2:count the number of valid, invalid, and duplicate numbers and print these to the user.* Part3: store the valid and invalid numbers in a list format and print these to the user. You need to make sure that a number is stored only Once.* Part4: Calculate and print the percentage of valid numbers, invalid numbers, and duplicate numbers to the user.* Part5:store the valid numbers, the sum of digits, and multiplication of the digits for each valid number in a list where each number is the 1st element of the list, the sum of digits is the 2nd element of the list and the multiplication of digits is the 3rd element of the list. Finally, print the nested list to the user. * Part6: Check whether the valid numbers are Awesome or not. **Awesome number:** a number where every digit is less than its immediate left digit is called an Awesome number. (e.g. 5421 an Awesome number).==============================================================================================**Sample Input1:**\"97821, 1 &nbsp;&nbsp;&nbsp;  , 97210,&nbsp;&nbsp; 963, &nbsp;&nbsp;&nbsp;979210 , 979210 "\**Sample Output1:**\Data after cleaning: [97821, 1, 97210, 963, 979210, 979210]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\================================================\Total numbers present in the given string: 6\Valid number count: 3\Valid numbers in list: [97821, 97210, 979210]\Invalid number count: 2\Invalid numbers in list: [1, 963]\Duplicate number count: 1\================================================\Valid number percentage(%): 50.0\Invalid number percentage(%): 33.333333333333336\Duplicate number percentage(%): 16.666666666666668\================================================\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\Data of valid numbers:\[number, sum of digits, product of digits]:\[[976321, 28, 2268], [9640, 19, 0], [3211, 7, 6]]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\^_^ Awesomeness checking of the Valid numbers ^_^\976321 an awesome number.\9640 an awesome number.\3211 a not-so-awesome number.\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==============================================================================================**Sample Input2:**\"976321, 321&nbsp;&nbsp;,&nbsp;&nbsp;&nbsp;9763221, &nbsp;&nbsp;&nbsp;9742, 876,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3211"\**Sample Output2:**\Data after cleaning: [976321, 321, 9763221, 9742, 876, 3211]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\================================================\Total numbers present in the given string: 6\Valid number count: 3\Valid numbers in list: [976321, 9742, 3211]\Invalid number count: 3\Invalid numbers in list: [321, 9763221, 876]\Duplicate number count: 0\================================================\Valid number percentage(%): 50.0\Invalid number percentage(%): 50.0\Duplicate number percentage(%): 0.0\================================================\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\Data of valid numbers:\[number, sum of digits, product of digits]:\[[976321, 28, 2268], [9640, 19, 0], [3211, 7, 6]]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\^_^ Awesomeness checking of the Valid numbers ^_^\976321 an awesome number.\9640 an awesome number.\3211 a not-so-awesome number.\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==============================================================================================**Sample Input3:**\"976321, 321 ,&nbsp;&nbsp;&nbsp; 9763221, 9742, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;876, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3211, 976321&nbsp;&nbsp;&nbsp;&nbsp;, 9742"\**Sample Output3:**\Data after cleaning: [976321, 321, 9763221, 9742, 876, 3211, 976321, 9742]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\================================================\Total numbers present in the given string: 8\Valid number count: 3\Valid numbers in list: [976321, 9742, 3211]\Invalid number count: 3\Invalid numbers in list: [321, 9763221, 876]\Duplicate number count: 2\================================================\Valid number percentage(%): 37.5\Invalid number percentage(%): 37.5\Duplicate number percentage(%): 25.0\================================================\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\Data of valid numbers:\[number, sum of digits, product of digits]:\[[976321, 28, 2268], [9640, 19, 0], [3211, 7, 6]]\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\^_^ Awesomeness checking of the Valid numbers ^_^\976321 an awesome number.\9640 an awesome number.\3211 a not-so-awesome number.\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<jupyter_code>lst1 = input("Enter a list: ")
lst1 = lst1[1:-1]
lst1 = lst1.split(", ")
final = []
for i in lst1:
    i = i.strip()
    i = int(i)
    final.append(i)
print("Data after cleaning:",final)
print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
lst1 = final.copy()
vfinal = []
vcount = 0
invfinal = []
invcount = 0
dupcount = 0
dup = []
for k in lst1:
    k = str(k)
    i = int(k)
    if len(k) >= 4 and len(k) <= 6 and i not in dup:
        vfinal.append(i)
        vcount += 1
    if len(k) < 4 or  len(k) > 6 and i not in dup:
        invfinal.append(i)
        invcount += 1
    if i in dup:
        dupcount += 1
    if i not in dup:
        dup.append(i)
print("================================================")
print("Total numbers present in the given string:",len(lst1))
print("Valid number count:",vcount)
print("Valid numbers in list:",vfinal)
print("Invalid number count:",invcount)
print("Invalid numbers in list:",invfinal)
print("Duplicate number count:",dupcount)
print("================================================")
print("Valid number percentage(%):",(vcount/len(lst1))*100)
print("Invalid number percentage(%):",(invcount/len(lst1))*100)
print("Duplicate number percentage(%):",(dupcount/len(lst1))*100)
print("================================================")
print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")

final = []
sum1 = 0
product = 1
for i in vfinal:
    i = str(i)
    num = int(i)
    for k in i:
        sum1 += int(k)
        product = int(k) * product
    final.append([num,sum1,product])
    sum1 = 0
    product = 1
print("Data",final)
print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
print("^_^ Awesomeness checking of the Valid numbers ^_^")


for k in vfinal:
    str1 = str(k)
    dup = None
    flag = True
    count = 0
    if len(str1) <= 1:
        flag = False
    else:
        for i in str1:
            i = int(i)
            if count == 0:
                dup = i
            elif i < dup:
                dup = i
            else:
                flag = False
                break
            count += 1
    if flag:
        print(str1,"is an awesome number.")
    else:
        print(str1,"is a not-so-awesome number.")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2457841000344155, 'fraction_numerical': 0.08919352988413445, 'mean_word_length': 4.912173618175653, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 21, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '343710', 'license': 'MIT', 'n_tokens_mistral': 5980, 'n_tokens_neox': 4837, 'n_words': 1758, 'path': 'PRACTICE PROBLEMS ON STRING & LIST_QUES.ipynb', 'repo_name': 'ikramulkayes/CSE110-practice', 'size': '17434'}