Nauč se Python > Kurzy > Beginners course PyLadies > Functions > Custom functions

Custom functions – Řešení [1]

  • pi is global - it's not defined within the function and it's accessible in the whole program.
  • area - Note there are two variables of that name! One is global ant the other one is local inside the function ellipse_area.
  • a - Note there are also two variables of that name. This was that catch: Writing a = a + 3 has no point. A value is assigned to the local variable a, but the function ends right after that, and this a is no longer available, it will never be used.
  • b is only local - it's an argument for the ellipse_area function.

Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.