What is the means of List[float]? [duplicate]

  1. it means that c is a list with float types in it.
  2. python doesn't force type hinting it's just a hint you can force it with assert.
  3. preferably every time it's just very helpful for you and others especially if you write with an IDE because then it can show you all the methods and members the object has.

You're using type hints feature, but python does not enforce static typing.

A simple way to make use of your code, and get your desired behaviour (an error) is with static type checker mypy - http://mypy-lang.org/

python -m pip install mypy
mypy yourCode.py

Result:

test.py:2: error: List item 4 has incompatible type "str"; expected "float"
Found 1 error in 1 file (checked 1 source file)