7
Last seen 5 years ago
Member for 6 years, 13 days
Difficulty Normal
You too can format the text with this way:
text = text.lower().split()
If you want to try to use the **dictionary comprehension** you can use:
return {x:text.count(x) for x in words}
Regards
More
You may use too:
text = text.lower().split()
to avoid import 're' library
More
In the line _2_ if you want you can improve with this:
return {word:text.lower().split().count(word) for word in words}
But there is an issue, in you list or dictionary comprehension by each interaction you are calling the text.**lower().split()** function, you can try this:
return (lambd
More
If we print **securityCheckList** with the following inputs we obtain:
>>> checkio('QwErTy911poqqqq')
>>> {'lowerCase': 9, 'upperCase': 3, 'digits': 3}
>>> checkio('asasasasasasasaas')
>>> {'lowerCase': 17, 'upperCase': 0, 'digits': 0}
>>> checkio('bAse730onE')
>>>
More
**I have implemented the Quick Sort algorithm.**
In each interaction I obtain the absolute value of the number and the pivot
I use the first element of the array as a pivot
You can improve this algorithm if you resolve the problem to obtain the absolute value of each element of the array in each
More
Example
checkio("Hello World hello")
Process
* [1,1,1]
* [3]
* 3 in [3] (return True)
checkio("He is 123 man")
Process
* [1,1,0,1]
* [2,2]
* 3 in [2,2] (return False)
checkio("bla bla bla bla")
Process
* [1,1,1,1]
* [3,3]
* 3 in [3,3] (return True)
More
We define a function called `convertToNumber` that function receive two parameters:
* An index base `0`
* The `character` in string format to be processed
Then we parse all the string and pass each `index, character` to the `convertToNumber` function
The function receive convert the `string`
More
First with an ternary operator I verify if the length of **data** is greater than or equal to 10, if not I return False
...Rest of the code... if len(data) >= 10 else False
### If length is greater than or igual to 10
With a **list comprehension** for **each letter of data** string, we are go
More
if len(number_array) > power_value
The ternary operator is evaluating if the array size is more than the power value(index).
* If the result is False:
* We return -1 value.
* If the result is True we return:
* The value of the array with index power_value by the power of power_value
More