Write a Python Function - Interview Practice - Code Conversation

preview_player
Показать описание
Whether you’re looking to ace your coding interview or simply to level up your development skills, solving coding challenges can help you grow as a programmer. In this Real Python Code Conversation, Philipp Ascany challenges Martin Bruess to write a function that doubles each character in a string.

This is a portion of the complete course, which you can find here:

The rest of the course covers:
- Writing tests
- Test Driven Development
- Additional Interview Practice Feedback
Рекомендации по теме
Комментарии
Автор

Great video. Loved hearing your though process from beginning to end.

gmalo
Автор

Great video, as always I did it by myself as a training before seeing he doing it and my first idea was to append to a list, but his solution is way cleaner lol
My solution looked like this:

def charDouble(word):
double = []
for char in word:
double.append(char)
double.append(char)

return("".join(double))

print(charDouble('martin'))

Also, can I get the name of that VSCode theme?

Desker_
Автор

If you were to create a third file and import the same function would that print out “Tree” too?

Beside that, Great video!

helloworld
Автор

Amazing :)
In one interview, interviewer asked me this question. if __name__=="__main__":

DeepakKumar-wudt
Автор

one line - "".join([f"{i}{i}" for i in string_val])

Skan
Автор

If this is a real coding interview you will fail unfortunately 😃 You have to do it so quickly.

JohnDoe-ybrg