Programing in Python [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
I need help with python. How can I separate combine word into two words. At the first we don't know what kind of words could be? so we must enter a string at the input (v="") and then that word must be separate. For example we have "AMnidcrheaal" and in output will be "Andrea" and "Michal".

According to the output you gave, you want to separate odd and even indices words which can be done as follows
v="AMnidcrheaal"
even=""
odd=""
for i in range(len(v)):
if i%2==0:
even+=v[i]
else:
odd+=v[i]
print(odd)
print(even)

Related

Python make list from string [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have column with this kind of data:
I want to count how many times valu occur in a row. It is a string, so I want to convert this '63,63,63,63,63,63,63,63,63,63,63' to this ['63','63','63'...].
I there any way to do this quickly?
Thanks
if given string is s
l=s.split(',')
l is the required list

Splitting strings in 80%/20% parts [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have a list of strings and I only want to keep the first 80% of text of each string. So, if a string has for example 100 words, I only want to keep the first 80 words. The split function is not suitable for this problem.
What function can I use, while iterating over the list, to achieve this?
Why isn't it?
sentence = "long string lots of words..."
parts = sentence.split()
newsentence = ' '.join(parts[:len(parts)*4//5])

What are the various ways to iterate over map() function other than list [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Suppose I have the some code in which I used map() function.
I know I can later print it by converting it to list just like this :
get_something = map(some_function, some_list)
print(list(get_something))
But Is there any way other than list. I mean what if I want to print not as list but line by line and don't want to use for loop every now and then?
Why dont you try this:
print(*map(some_function, some_list),sep='\n')
By this print() will refer to map object and will print values with \n as a separator

Find all words that include four consecutive vowels [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Tetravocalic: Find all words that include four consecutive vowels.
def Tetravocalic(i):
return(re.search("/\b.*[aeiou]+.*[aeiou]+.*[aeiou]+.*[aeiou]+{4}/\b",i)))
Tetravocalic("vajjekiohkkugh")
error: multiple repeat at position 42
Please let me know the meaning of the error and the correct code as well.
ex: Tetravocalic("vajjekiohkkugh apple ororaeeg")
Your regular expression is way too complex, you only need this :'[aeiou]{4}'.
Example code:
def has_four_consecutive_vowels(s):
return bool(re.search('[aeiou]{4}', s))

Find word in a string where word is not present as a whole instead it's scattered [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need to find a word "little" in a string but word in the string is not present as a whole.
For eg. input string="aalbeiedteetoolpue" or "lliittttllleee"
May be you can try this:
\b\w*l\w*i\w*t\w*t\w*l\w*e\w*\b
Demo

Categories