Skip to content

Functions/return val (Lesson 7 Task 3) exercise is not to the point #20

@dz0

Description

@dz0

The exercise expects one to understand fib sequence generation algorithm, but not the function "return" mechanism...

I'd propose to take some other example:

def sign(x):
   """ function returns the sign of number: 1 if positive, -1 if negative, or 0
        ps.: return exits fuction, so no further actions happen after it occurs
   """
    if x > 0:
        return 1     # placeholder "return 1"
    if x < 0:      
        return -1    # placeholder "return"
    return 0   #  placeholder "0"

https://github.com/JetBrains/pycharm-courses/blob/master/introduction_course_v2/lesson7/task3/return_keyword.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions