Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link
  1. array[-1] and string[-1] last letter and last string retrieval

    array[-1] and string[-1] last letter and last string retrieval

    I originally used len(string/array)-1 to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable

  2. Main inside or outside of class

    I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.

  3. play function if,elif,else

    the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  4. if word == ''

    Not sure if unorthodox but there should be a better comparison

  5. word.lower(), word.strip(), self.currentWord = word

    There might be a better way of combining this?

I originally used len(string/array)-1 to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable

  1. Main inside or outside of class

I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.

  1. play function if,elif,else

the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  1. if word == ''

Not sure if unorthodox but there should be a better comparison

  1. word.lower(), word.strip(), self.currentWord = word

There might be a better way of combining this?

  1. array[-1] and string[-1] last letter and last string retrieval

I originally used len(string/array)-1 to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable

  1. Main inside or outside of class

I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.

  1. play function if,elif,else

the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  1. if word == ''

Not sure if unorthodox but there should be a better comparison

  1. word.lower(), word.strip(), self.currentWord = word

There might be a better way of combining this?

  1. array[-1] and string[-1] last letter and last string retrieval

    I originally used len(string/array)-1 to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable

  2. Main inside or outside of class

    I chose inside however maybe it should be outside of the class as it makes sense to have the main loop there and keep it separate from the object however it is the main controls so I am unsure.

  3. play function if,elif,else

    the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  4. if word == ''

    Not sure if unorthodox but there should be a better comparison

  5. word.lower(), word.strip(), self.currentWord = word

    There might be a better way of combining this?

Tweeted twitter.com/StackCodeReview/status/1235535621369839616
edited body
Source Link
AlexV
  • 7.4k
  • 2
  • 24
  • 47
  1. Main inside or outsdteoutside of class
  1. Main inside or outsdte of class
  1. Main inside or outside of class
added 42 characters in body; edited tags
Source Link
AlexV
  • 7.4k
  • 2
  • 24
  • 47

-Edit1-

Edit 1

Code Explanation

Code Explanation OnceOnce run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should exceptaccept a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don'ydon't match then the game goes into the 'game over' function which resets the game automatically.

Unorthodox choices:

Unorthodox choices

  1. array[-1]array[-1] and string[-1]string[-1] last letter and last string retrieval

I originally used len(string/array)-1len(string/array)-1 to retrieve the last letter/string however. However this seems movemore visually appearingappealing but it is questionable whether it is readable

  1. Main inside or outsiteoutsdte of class
  1. play function if,elif,elseif,elif,else

the ifif and elifelif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  1. if word == ''if word == ''
  1. word.lower()word.lower(), word.strip() self.currentWord = wordword.strip(), self.currentWord = word

-Edit1-

Code Explanation Once run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should except a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don'y match then the game goes into the 'game over' function which resets the game automatically.

Unorthodox choices:

  1. array[-1] and string[-1] last letter and last string retrieval

I originally used len(string/array)-1 to retrieve the last letter/string however this seems move visually appearing but it is questionable whether it is readable

  1. Main inside or outsite of class
  1. play function if,elif,else

the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  1. if word == ''
  1. word.lower(), word.strip() self.currentWord = word

Edit 1

Code Explanation

Once run the code should run the main function of the class which will loop over until the user decided to quit by pressing enter (entering an empty string). Otherwise the program should accept a string of characters as words. Please note there is no parsing of the data except turning the word into lowercase and removing any additional spaces. The entered word will be checked against an array to see if the two rules match up, if the rules don't match then the game goes into the 'game over' function which resets the game automatically.

Unorthodox choices

  1. array[-1] and string[-1] last letter and last string retrieval

I originally used len(string/array)-1 to retrieve the last letter/string. However this seems more visually appealing but it is questionable whether it is readable

  1. Main inside or outsdte of class
  1. play function if,elif,else

the if and elif statement do the same thing, there should be a more efficient way of doing it without separating the action into the function and having both statements

  1. if word == ''
  1. word.lower(), word.strip(), self.currentWord = word
spacing
Source Link
Loading
Source Link
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /