3

I don't know what you mean by "more easily", but here are some comments on the code: No error handling In many statements like i=int(input());list.append(alphabet1[i-1]) you use user input directly to index a list, without checking if it is in range, or even if it is a number. One wrong keystroke from the user and the whole program crashes. Mixed ...


2

This looks like a nice game. Let's see how we can improve your code. we can STOP using ;. This is Python, not C / C++ / Java etc reorder your code so that it reads easier. rename your functions / variables so that the words are delimited by _. we can use the string stdlib library to generate your alphabets without repeating ourselves so much: import string ...


1

Review Use semicolons. Why? If you don't know why you should use them, then you should use them. Not using them can result in very hard to track down bugs that will waste hours of your valuable time. Use const wherever and whenever possible. The return expression Object.assign(arraya) does nothing and is not required ( Object.assign returns the first ...


1

The answers here are great, especially if you're looking to implement this algorithm in a faster way (which would be very important to do if there could potentially be a lot of points - the current implementation would be slow on large lists). ...however, I didn't see anything in the problem description about speed being a needed factor. I tend to put code ...


1

I decided to take a crack at simplifying this problem myself as it sounded like a fun challenge. @SᴀᴍOnᴇᴌᴀ already offered a bunch of good advice. The main thing I want to add is how important it is to be able to split up the logic into well-named and easily understandable helper functions. You did have one small helper function in there, but one or two more ...


Only top voted, non community-wiki answers of a minimum length are eligible