erla | erlang style actor for scala & akka via continuations
kandi X-RAY | erla Summary
kandi X-RAY | erla Summary
More erlang style actor for scala & akka via continuations plugin.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of erla
erla Key Features
erla Examples and Code Snippets
Community Discussions
Trending Discussions on erla
QUESTION
I've decide to practice solving anagrams, something I'm very bad at. I got 1000 most common words of English language, filtered those under 5 letters and over 9 and then wrote a simple script:
...ANSWER
Answered 2019-Nov-17 at 07:08You have to strip the newlines out of the word.
Basically, your text file is actually formatted as a word on each line and a '\n' character at the end of each line. When you call random.shuffle(question_list)
, your are shuffling the characters of the word along with the newline character, so the newline is also shuffled! When you print out the 'shuffled' word, Python prints the word out with the newline, so you get the word randomly split between two lines.
In order to solve this issue, you can probably use the str.strip()
function (but that would require you cast the list to a string) or just add this to below question_list = list(words[i])
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install erla
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page