The code beneath is one in all my earliest Python codes and I discover it terribly cute :3
My code enter:
print(“WELCOME TO PYPET“)
bunny = {
“identify” : “Muffy”,
“hungry”: False,
“weight”: 5.4,
“age”: 4,
“picture”: “(-‘.’-)”,
}
fowl = {
“identify”: “Bell”,
“hungry”: True,
“weight”: 0.7,
“age”: 2,
“picture”: “(v)”,
}
print(“Howdy ” + bunny[“name”] + “!”)
print(bunny[“photo”])
print(“- – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – “)
print(“Howdy ” + fowl[“name”] + “!”)
print(fowl[“photo”])
def feed(pet):
if pet[“hungry”] == True:
pet[“hungry”] = False;
pet[“weight”] = pet[“weight”] + 1
else:
print(“The Pypet shouldn’t be hungry.”)
pets = [bunny, bird]
print(“- – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – “)
for pet in pets:
feed(pet)
print(pet)
print(“- – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – “)
print(“It appears all is properly right here!”)
print(bunny[“photo”] + “<3 ” + fowl[“photo”] + “<3 “)
My code output:
WELCOME TO PYPET
Howdy Muffy!
(-‘.’-)
Howdy Bell!
(v)
The Pypet shouldn’t be hungry.
{‘identify’: ‘Muffy’, ‘hungry’: False, ‘weight’: 5.4, ‘age’: 4, ‘picture’: “(-‘.’-)”}
{‘identify’: ‘Bell’, ‘hungry’: False, ‘weight’: 1.7, ‘age’: 2, ‘picture’: ‘(v)’}
It appears all is properly right here!
(-‘.’-)<3 (v)<3
A screenshot of my code enter and output:
Run my Pypet program on Sololearn: https://www.sololearn.com/compiler-playground/cc7aEOtvMmUi
I don’t really feel the least unhealthy about my outdated code. It’s what it’s. It was a begin, my begin and all of us have to start out someplace!
Are you ashamed of your outdated code?