Skip to content

Instantly share code, notes, and snippets.

@vaibhavmule
Last active October 9, 2017 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaibhavmule/b63acef347f11fc2f5e21efdf80a4936 to your computer and use it in GitHub Desktop.
Save vaibhavmule/b63acef347f11fc2f5e21efdf80a4936 to your computer and use it in GitHub Desktop.
find_angle_between_hours_and_minutes - https://repl.it/MIr5/7 full_house_or_not - https://repl.it/MSxN/0
def calculate_angle(hour, minute):
"""
Assuming 12 hours is 360 degree which is
(720 minutes) or 0.5 degree per minute
and 60 minutes = 360* which 6 degree per minutes.
"""
if hour == 12 and minute == 60:
hour, minute = 0, 0
angle_of_hour_hand = (60 * hour + minute) / 2
angle_of_minute_hand = 6 * minute
angle = angle_of_hour_hand - angle_of_minute_hand
if angle > 180:
return abs(360 - angle)
else:
return abs(angle)
print(calculate_angle(1, 20))
def is_full_house(list_of_cards):
"""
:list_of_cards - array of integers.
"""
unique_cards = set(list_of_cards)
if len(unique_cards) == 2:
first_card, second_card = unique_cards
first_counter = list_of_cards.count(first_card)
second_counter = list_of_cards.count(second_card)
first_condition = first_counter == 2 and second_counter == 3
second_condition = first_counter == 3 and second_counter == 2
if first_condition or second_condition:
return True
return False
print(is_full_house([1, 2, 1, 2, 1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment