File tree Expand file tree Collapse file tree 15 files changed +16
-16
lines changed
20-logic-combine-expressions
26-conditions-inside-loops Expand file tree Collapse file tree 15 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 1- def is_international_phone (phone ) :
1+ def is_international_phone (phone : str ) -> bool :
22 return phone [0 ] == "+"
Original file line number Diff line number Diff line change 1- def is_leap_year (year ) :
1+ def is_leap_year (year : int ) -> bool :
22 return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0 )
Original file line number Diff line number Diff line change 1- def is_palindrome (word ) :
1+ def is_palindrome (word : str ) -> bool :
22 lower_word = word .lower ()
33 return lower_word == lower_word [::- 1 ]
44
55
6- def is_not_palindrome (word ) :
6+ def is_not_palindrome (word : str ) -> bool :
77 return not is_palindrome (word )
Original file line number Diff line number Diff line change 1- def string_or_not (value ) :
1+ def string_or_not (value : str ) -> str :
22 return isinstance (value , str ) and "yes" or "no"
Original file line number Diff line number Diff line change 1- def normalize_url (url ) :
1+ def normalize_url (url : str ) -> str :
22 prefix = "https://"
33 if url [:8 ] == prefix :
44 return url
Original file line number Diff line number Diff line change 1- def who_is_this_house_to_starks (house_name ) :
1+ def who_is_this_house_to_starks (house_name : str ) -> str :
22 if house_name == "Karstark" or house_name == "Tully" :
33 return "friend"
44 elif house_name == "Lannister" or house_name == "Frey" :
Original file line number Diff line number Diff line change 1- def flip_flop (arg ) :
1+ def flip_flop (arg : str ) -> str :
22 return "flop" if arg == "flip" else "flip"
Original file line number Diff line number Diff line change 1- def get_number_explanation (number ) :
1+ def get_number_explanation (number : int ) -> str :
22 match number :
33 case 666 :
44 return "devil number"
Original file line number Diff line number Diff line change 1- def multiply_numbers_from_range (start , finish ) :
1+ def multiply_numbers_from_range (start : int , finish : int ) -> int :
22 i = start
33 result = 1
44 while i <= finish :
Original file line number Diff line number Diff line change 1- def join_numbers_from_range (start , end ) :
1+ def join_numbers_from_range (start : int , end : int ) -> str :
22 i = start
33 result = ""
44 while i <= end :
You can’t perform that action at this time.
0 commit comments