This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_ratings(players): | |
# Get the sum for all players ratings | |
player_ratings = map(lambda x: x.ratings, players) | |
sum_player_ratings = sum(player_ratings) | |
# Also get the average | |
average_player_ratings = sum_player_ratings / 11 | |
# Calculate the correction factor (for each player, it's either positive delta or 0) and get the total. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const noOfShownComments = 5; | |
const commentsIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
console.log(!!(noOfShownComments => commentsIds.length | |
? true | |
: false})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is how regular switches are typically made: | |
function regularSwitch(case) { | |
switch(case) { | |
case "default": | |
return "green"; | |
case "ignored": | |
return "red"; | |
case "selected"; | |
return "grey"; |