Today we had an assignment to write a simple code, and to see if it worked. You were meant to write a program that asks the user what is their name, and then to ask what is that persons favorite programming language. The end result should look like this: Chloe loves programming in Python.
Initially my idea was to do like many of the others have done it. Writing each step as a separate function, ending up with an end result that is like that. Now, what I wanted to try was to write a more clean and agile code, not using too much code that is not really needed. In some cases, yes, you might need to write the variables separate, but in this case – the task was to only do this.
In the past I have been trying to always clean up the code and make it more agile. Sometimes that can come back and bite you in the ass, because it just wont work. I were then wondering how Python would handle me trying to write a code based on using my human logic. And yeah – it did work like a charm. I ended up with a nice little code that did the whole trick. In just one function. Here it is:
print(input("What is your name? - "), "loves programming in", input("What is your favorite programming language? - "))
And this is how it looks when you run it: