Hiya! I’m currently working my way through Replit’s 100 days of code, really enjoying it. I generally try to avoid checking the solutions until I’ve worked out my own solution, and then I’ll click through to watch the solution video to make sure I’ve understood everything/see if there’s anything I’ve missed. I’m up to day 42 now and recently when I check the solution, I’ve coded things in a different way to the solution, but my code has still ran and has worked. Is this okay? Are there specific ways I should be learning to do things or is making it work what counts?
For example, today’s challenge was to make a dictionary, use a loop to output the names of the keys, get the user to input values for those keys, store that in the dictionary and then print out the whole dictionary.
my code:
dictionary = {"Name": None, "Url": None, "Desc":None, "Rating":None, "new thing":None}
for key in dictionary:
j = input(f"{key}: ")
dictionary.update({key:j})
print()
for key, value in dictionary.items():
print(f"{key}: {value}")
solutions code:
website = {"name": None, "url": None, "desc": None, "rating": None}
for name in website.keys():
website[name] = input(f"{name}: ")
print()
for name, value in website.items():
print(f"{name}: {value}")
Is this okay? I don’t want to be creating bad habits or missing things by doing things a different way. Sorry if this is a dumb question!