Self-taught programmer turned Comp Sci student -> exploring the depths of Python & C-languages | Aspiring composer of video game music | Bassist | Coffee enthusiast.
assert ukraine_capital_2 is ukraine_capital_1
assert ukraine_capital_3 is ukraine_capital_1
How did this code pass the assertion tests (seen above)? Perhaps this mission's tests were updated after your initial post, but your code does not generate a singleton. Capital.city_name == "Kyiv" bu
More
I had this as the core of my code, for so long, but I kept iterating over the **text** instead of **string.ascii_lowercase**...resulting in my 13 lines of code. I can't believe I didn't realize max() would pull the correct first instance (where multiple matches were found) due to **string.ascii_lowe
More
Cheers! Nice code! There are a few things you'll want to be careful with, though. Try to stay consistent with adding spaces on either side of your operators (+, -, etc), and keep an eye on the extra amount of white space you use. Blank lines are great for separating logical sections, but you don't w
More
Nice code, fam! Your logic is on point; but, you could save yourself a TON of typing, in the future, by simply defining a "base class" (the Warrior class) with the **default** self.health, and self.attack - and follow up by only setting the "new" attributes in the subclasses.
class Warrior(obje
More
You got me beat with your 'age-check.' I always forget that I can just throw a variable betwixt two comparison operators. Nicely done!
More
Nice code! I like how you defined a simple function for gathering the protectors; however, I would have implemented it before safe_pawns(). That way, by the time you read line 8, you already know what protectors() does. Also, your way of defining the borders of the chessboard (the 'x' in your ROWS a
More
Nice code! I like that you were able to craft a short solution without any imports, sorting, or even lists/dictionaries. I was able to get my code down to 14 lines, as well (including my docstring), but I couldn't have figured it out without using the aforementioned techniques. I'll have to mess aro
More
Nice code! I prefer encapsulating the Warrior's health and attack in actual parameters of the class (_instance_ attributes), rather than _class_ attributes, but this definitely works. Your fight() function could be further simplified on line 16 and 17 by using '**-=**' which would save you from rety
More