insert letter before vowel in word [closed] - python-3.3

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 8 years ago.
Improve this question
how to insert letter before vowel in each word in python. like Gibberish game. We have to ask user to to input some letter and input their word to insert some letter that they input at first to before vowels in each word they input at second.

If this is for homework, you really should try to figure this out on your own rather than going to StackOverflow, but you can use regex to do it in one line:
import re
re.sub(r"([aeiou])",r"X\g<1>", "hello")
Or if you want a function version of it:
import re
def add_letter_to_vowels(word, letter):
return re.sub(r"([aeiou])",r"%s\g<1>"%letter, word)
Then it runs as follows:
>>> add_letter_to_vowels("hello", "X")
'hXellXo'
Regular expressions are very powerful, read more about them here and the API reference is here

Related

How to change specific part of a string? [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
For example, I have a string like this
a = "starlight sunlight"
And I want to change it into
a = "starspot sunspot"
well i guessed you writing this in python so you can use the replace method
enter example
in your case you went to replace the word light with the word spot so just write
a=a.replace("light","post")

How to find the number of common characters of two input strings in Assembly? [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 compare two input strings and display the number of common characters in Assembly but i can't find how to do that.
To do it efficiently you would need some sort of data structure to remember which characters you have seen already.
If you don’t mind duplicates and don't need efficiency, you could loop over the first string and, for each character, loop over the second string and compare them (adding one to a register or a variable when they match).

Ask the user for its name using raw_input [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 8 years ago.
Improve this question
How do I write a program that uses raw_input to prompt a user for their name and then welcomes him.
For example that asks: Enter your name, and then the program continues welcoming the user with Hello NAME_OF_THE_USER
This is one of the easiest problem ever. This is my solution (since you tagged your post for Python 3):
name = input('Enter your name: ')
print("Welcome", name)
For Python 2, just change input to raw_input, and remove the parenthesis of the print function.

Python similar type of string to search [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 8 years ago.
Improve this question
I have just started learning python and I have a question. I have a text file which I opened. The file has random questions. Now my question is how can I search for any question similar to this type of question "what is your .... " and "how do you ...." and return the whole question . I am using python 3.x. Please help
I highly suggest you spend some time reading about regex. The trick would be to search for a string that includes the first words you want (the "What is your" statement) and ends with a question mark. The following docs should give you quite a bit of clarity.
https://docs.python.org/3.4/library/re.html
https://docs.python.org/3.4/howto/regex.html#regex-howto

Polish dictionary database - weird symbols (subst:sg:voc:f) - what are they? [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 9 years ago.
Improve this question
As in the title, I am working with database containing a Polish dictionary where one of the columns contains records such as:
subst:sg:voc:f
subst:pl:nom.voc:m1
subst:sg:dat:m3
What are those tags? What are they called? How do I read them?
Not knowing anything else about the dictionary (nor polish) they appear to be:
type of word (substantive, verb, adjective, etc)
number (sg: singular, pl: plural)
decliantion (voc: vocative, dat: dative)
gender and person (f: feminine, m1: masculine first person, m3: masculine third person)

Resources