<jupyter_start><jupyter_text>Q1. Does assigning a value to a string's indexed character violate Python's string immutability?Yes. It is beacause of string immutability that means we can not change the characters in string by assigning new values to indexes.  Q2. Does using the += operator to concatenate strings violate Python's string immutability? Why or why not?No. When we concatenate string, we assign new value to the same string variable. We are not altering string based on the indexes, so it won't violate Python's string immutability  Q3. In Python, how many different ways are there to index a character?There are two methods for this, find() and index() both will return the lowest index at which char is found.  Q4. What is the relationship between indexing and slicing?Indexing is a way to access an element of a string by its position or index. Slicing is accessing only part od a string and not a full string. String slicing is done by using index.<jupyter_code>s = 'ineuron'

print(s[1:4])
print(s[-1:2:-1])<jupyter_output>neu
noru<jupyter_text>Q5. What is an indexed character's exact data type? What is the data form of a slicing-generated substring?For both cases, it is 'str' type.  Q6. What is the relationship between string and character "types" in Python?In Python, There is no char data type, even a single character enclosed in doubble quotes is considered as str.  Q7. Identify at least two operators and one method that allow you to combine one or more smaller strings to create a larger string."+" will concatenate two strings and "*" will repeat the string number of times mentioned. We can also use join() method for getting a larger string.<jupyter_code>print("Hello!" + 'How are you?')

print("AJIT" * 4)

l = ['How', 'are', 'you?']

s = ' '.join(l)

print(s)<jupyter_output>Hello!How are you?
AJITAJITAJITAJIT
How are you?<jupyter_text>Q8. What is the benefit of first checking the target string with in or not in before using the index method to find a substring?Normally, when we use index() method it will return the starting index of a substring, if substring is present in a string. But the major concern is if a substring is not present in a string, index() will return a ValueError. To avoid this, we can first check the target string with in or not in before using the index method to find a substring.<jupyter_code>s = 'ajitkumarrai'

s1 = 'abc'

if s1 in s:
    print(s.index(s1))

s.index(s1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06601863102470636, 'fraction_numerical': 0.007290400972053463, 'mean_word_length': 4.67816091954023, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '430347', 'license': 'MIT', 'n_tokens_mistral': 721, 'n_tokens_neox': 690, 'n_words': 378, 'path': 'Python_Advance_Assignment_12.ipynb', 'repo_name': 'raiajit022/Python-Advance-Assignment', 'size': '2469'}