<jupyter_start><jupyter_text>Assignment 14 Solutions  Q1. Is an assignment operator like += only for show? Is it possible that it would lead to faster results at the runtime ?**Ans:** **`A=A+1`** evaluates to finding `A`, adding 1 to it. Then storing the value again in variable `A`. This expression makes Python to look for memory holder of a twice. But `A+=1` simply means value of `A` is to incremented by 1. As memory address has to be identified once, `+=` leads to faster operation.   Q2. What is the smallest no of statements you'd have to write in most programming languages to replace the Python expr **`a, b = a + b, a`** ?**Ans:** Minimum number of lines required to write above code in languages other Python will be 4, two for assigning initial values for variables `a` and `b`, and two for reassignment i.e. `a=a+b` and `b=a`.   Q3. In Python, what is the most effective way to set a list of 100 integers to 0?**Ans:** The Most effective way to set a list of 100 integers to 0 in python is by using repition operator(`*`) or by using list comprehension.<jupyter_code># Method 1
list_zero=[0]*100
print(list_zero)
# Method 2
zero_list = [0 for x in range(100)]
print(zero_list)<jupyter_output>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]<jupyter_text>Q4. What is the most effective way to initialise a list of 99 integers that repeats the sequence 1, 2, 3? S If necessary, show step-by-step instructions on how to accomplish this.<jupyter_code>my_list = [1,2,3]*33
print(my_list)<jupyter_output>[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]<jupyter_text>Q5. If you're using IDLE to run a Python application, explain how to print a multidimensional list as efficiently?<jupyter_code>my_list = [[1,1],[2,2],[3,3],[4,4],[5,5]] # 2 dimensional List
for x in range(len(my_list)):
    for y in range(len(my_list[x])):
        print(my_list[x][y],end=" ")<jupyter_output>1 1 2 2 3 3 4 4 5 5<jupyter_text>Q6. Is it possible to use list comprehension with a string? If so, how can you go about doing it?**Ans:** List comprehension with string is possible.<jupyter_code>my_list = [ele for ele in 'iNeuron']
print(my_list)<jupyter_output>['i', 'N', 'e', 'u', 'r', 'o', 'n']
{'fraction_non_alphanumeric': 0.1789544235924933, 'fraction_numerical': 0.12097855227882037, 'mean_word_length': 3.5923076923076924, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '73251', 'license': 'MIT', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1254, 'n_words': 604, 'path': 'Python Advance/14.Assignment_14.ipynb', 'repo_name': 'Sayan97/Python', 'size': '2984'}