Skip to content

Latest commit

 

History

History

0x00-python_variable_annotations

0x00. Python - Variable Annotations

About

  • Dynamic vs. static typing
  • Type hints
  • Genetic types
  • mypy checker

Tasks

  1. Type-annotated function add that takes a float a and a float b as arguments and returns their sum as a float.
  2. Type-annotated function concat that takes a string str1 and a string str2 as arguments and returns a concatenated string
  3. Type-annotated function floor which takes a float n as argument and returns the floor of the float.
  4. Type-annotated function to_str that takes a float n as argument and returns the string representation of the float
  5. Variable annotations
  6. Type-annotated function sum_list which takes a list input_list of floats as argument and returns their sum as a float.
  7. Type-annotated function sum_mixed_list which takes a list mxd_lst of integers and floats and returns their sum as a float.
  8. Type-annotated function to_kv that takes a string k and an int OR float v as arguments and returns a tuple. The first element of the tuple is the string k. The second element is the square of the int/float v and should be annotated as a float.
  9. Type-annotated function make_multiplier that takes a float multiplier as argument and returns a function that multiplies a float by multiplier.
  10. Function annotations
  11. Duck-type annotations
  12. Type aliases
  13. Type Checking