Problem
You've been working on a particularly difficult algorithm all day, and finally decided to take a break and drink some coffee. To your horror, when you returned you found out that your cat decided to take a walk on the keyboard in your absence, and pressed a key or two. Your computer doesn't react to letters being pressed when an unauthorized action appears, but allows typing whitespace characters and moving the arrow keys, so now your masterpiece contains way too many whitespace characters.
To repair the damage, you need to start with implementing a function that will replace all multiple space characters in the given
line
of your code with single ones. In addition, all leading and trailing whitespaces should be removed.
Example
For
the output should be
line = "def m e gaDifficu ltFun ction(x):"
,the output should be
catWalk(line) = "def m e gaDifficu ltFun ction(x):"
.
Input/Output
- [execution time limit] 4 seconds (py)
- [input] string lineOne line from your code containing way too many whitespace characters.Guaranteed constraints:
5 ≤ line.length ≤ 125
. - [output] string
line
with unnecessary whitespace characters removed.
Solution
def catWalk(code): return " ".join(code.strip().split())
Awesome post and i got more information regarding the programming
ReplyDeleteDOT NET training in bangalore
dot net training institute in bangalore
dot net course in bangalroe
best dot net training institute in bangalore
I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai
DeleteAppyzone
ReplyDeleteYou can get free mac & pc applications. You are one click away from getting best cracks, cheats, and patches of games www.appyzone.com
Its worth information. thank you for sharing this information
ReplyDeleteDOT NET training in Marathahalli
dot net training institute in Marathahalli
dot net course in Marathahalli
best dot net training institute in Marathahalli
Nice post..
ReplyDeleteDOT NET training in btm
dot net training institute in btm
dot net course in btm
best dot net training institute in btm
All good. I am a newcomer, so I jerked until the money was withdrawn. I waited 2 days on Yandex. Thanks to the admins and support service for listening to my whining on the forum and in the chat. Play people! Do not be greedy. All the rules with this casino! perfect casino slot machine games I often spend my time here
ReplyDeleteYour article is worth reading! You are providing a lot of valid information. This'll be really helpful for my reference. Do share more such articles.
ReplyDeleteWordPress Training in Chennai
WordPress Training Chennai
Mobile Testing Training in Chennai
Mobile Testing Course in Chennai
Oracle Training in Chennai
Oracle Course in chennai
WordPress Training in OMR
WordPress Training in Tambaram
This comment has been removed by a blog administrator.
ReplyDeleteA network consists of two or more computers that are linked in order to share resources (such as printers and CDs), exchange files, or allow electronic communications. .
ReplyDeletefinal year project
mini projects for cse
final year projects for cse
final year projects for cse students
final year projects for cse domains
final year projects for cse in data mining
final year projects for cse with source code
final year project for ece
final year project in mechanical engineering
final year project for eee