Answer:
The right answer is option 4: 2
Explanation:
Lists are used in Python to store elements of same or different data types.
Different functions are used in Python on List. One of them is count.
Count is used to count how many times a specific value occurs in a list.
The syntax for count is:
listname.count(value)
In the given code,
The output will be 2
Hence,
The right answer is option 4: 2
Before text = indents paragraph to the right
First line = indents the start of a paragraph
Register-true = formats page styles
Line spacing = manages space between two lines
The first line always gets indent to specify that it is a start of the paragraph
Line spacing always focus on the number of spaces between lines. There are various values available to give spacing according to the need. Register- true is used to format all the page styles and do other related configurations.
Answer:
- def normalize(input_string):
- output = []
-
- for c in input_string:
- if(c.isalpha()):
- output.append(c.lower())
-
- return output
-
- print(normalize("O.K. #1 Python!"))
Explanation:
Firstly, create a function normalize that takes one input string (Line 1).
Next, we create an empty list and assign it to output variable (Line 2). This list will hold all the letters from the input string.
Create a for loop to traverse each of the character in the input string (Line 4) and then use isalpha() method to check if the current character is a letter (Line 5). If so, add the letter to output list (Line 6). Please note we can convert the letter to lowercase using lower() method.
After completing the loop, return the output list (Line 8).
We can test the function using the sample input given in the question (Line 10) and we shall get ['o', 'k', 'p', 'y', 't', 'h', 'o', 'n']