Skip to content

Commit f6b8d34

Browse files
committed
add type annotation
1 parent 60f8feb commit f6b8d34

File tree

15 files changed

+16
-16
lines changed

15 files changed

+16
-16
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def is_international_phone(phone):
1+
def is_international_phone(phone: str) -> bool:
22
return phone[0] == "+"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
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)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def string_or_not(value):
1+
def string_or_not(value: str) -> str:
22
return isinstance(value, str) and "yes" or "no"

modules/48-conditionals/40-if-else/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def normalize_url(url):
1+
def normalize_url(url: str) -> str:
22
prefix = "https://"
33
if url[:8] == prefix:
44
return url

modules/48-conditionals/50-else-if/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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":
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def flip_flop(arg):
1+
def flip_flop(arg: str) -> str:
22
return "flop" if arg == "flip" else "flip"

modules/48-conditionals/65-match/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def get_number_explanation(number):
1+
def get_number_explanation(number: int) -> str:
22
match number:
33
case 666:
44
return "devil number"

modules/50-loops/20-aggregation-numbers/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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:

modules/50-loops/23-aggregation-strings/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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:

0 commit comments

Comments
 (0)