The code below is one of my earliest Python codes and I find it terribly cute :3
My code input:
print("WELCOME TO PYPET")
bunny = {
"name" : "Muffy",
"hungry": False,
"weight": 5.4,
"age": 4,
"photo": "(-'.'-)",
}
bird = {
"name": "Bell",
"hungry": True,
"weight": 0.7,
"age": 2,
"photo": "(v)",
}
print("Hello " + bunny["name"] + "!")
print(bunny["photo"])
print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
print("Hello " + bird["name"] + "!")
print(bird["photo"])
def feed(pet):
if pet["hungry"] == True:
pet["hungry"] = False;
pet["weight"] = pet["weight"] + 1
else:
print("The Pypet is not hungry.")
pets = [bunny, bird]
print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
for pet in pets:
feed(pet)
print(pet)
print("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
print("It seems all is well here!")
print(bunny["photo"] + "<3 " + bird["photo"] + "<3 ")
My code output:
WELCOME TO PYPET
Hello Muffy!
(-'.'-)
Hello Bell!
(v)
The Pypet is not hungry.
{'name': 'Muffy', 'hungry': False, 'weight': 5.4, 'age': 4, 'photo': "(-'.'-)"}
{'name': 'Bell', 'hungry': False, 'weight': 1.7, 'age': 2, 'photo': '(v)'}
It seems all is well here!
(-'.'-)<3 (v)<3
A screenshot of my code input and output:
Run my Pypet program on Sololearn: https://www.sololearn.com/compiler-playground/cc7aEOtvMmUi
I do not feel the least bad about my old code. It is what it is. It was a start, my start and we all have to start somewhere!
Are you ashamed of your old code?
Latest comments (41)
In a word, no.
I do feel some negative emotions when previously working implementation stops working, even though it's remained unchanged for
[insert age of last commit here]
... But never shame.If there is any emotion, thought or action that my previous work inspires in me, it's the same when one I experience when working with less knowledgeable or experienced developers: kindness.
it looks good for a practise for dict in Python
It isn't necessary to feel shame in order to look back and understand that you would do things differently today, knowing that your that your knowledge and experience have grown since then. Maybe better to think of it as feeling proud about how far you've progressed.
Sure no, that is what I was studying with) I had a period in time, when I hided my projects from others, but later I started to view some other person`s projects and saw that everyone make silly mistakes and use inappropriate methods.
Exactly! Well said!
Not at all. When I or someone else looks at my old code, I hope they say, "You have come a long way."
Which is also an excellent way of saying I have learned and expanded my understanding of the problem I was solving.
This is also something I learned to get over real fast when I started live streaming development thanks to all the back seat coders :)
This is an excellent way of looking at your old code! I like to see my code this way as well :)
I use javascript, which means I am ashamed of all code I write :)
What do you mean? I know a little Javascript but I still do not get what you meant.
I miss my old code tbh. Lack of knowledge made me more creative in finding solutions with rudimentary tools. Building Command Line games built 100% off of 600 line if else trees was such an interesting time. Though nothing I wrote in my first year of code was considered "good" I was so proud of it. So no, I was proud then and I still am today.
Thank you so much! 😊
Woah, awesome! Oh, and writing my own operating system has truly been on my mind! You seem to be quite the hustler, you are AWESOME! ✨
Sometimes, reviewing old code reveals many great things, especially from 10 years ago, even though I lacked experience at that time
Not as much as I hate my older stuff in other disciplines (which I dispise), the most hatred I get out of it is trying to understand it but that'd be the same for anyone else's shitty and uncommented code