I'm asking you a question

Asked 2 years ago, Updated 2 years ago, 107 views

Hello, I'm asking you a question because I don't understand while studying data analysis with PandaSas.

def make_generation(age):
    if age == -1:
        return 'Not entered'
    elif age // 10 >= 4:
        "Late 30s"
    elif age // 10 == 1:
        "Teenage"
    elif age % 10 < 3:
        return str (age // 10 * 10) + f"early"
    elif age % 10 <= 6:
        return str (age // 10 * 10) + f"Middle of"
    else:
        return str (age // 10 * 10) + f "late to late"

  make_generation(39)

I don't understand how the late 30s come out when we make a function here and apply 39 I kind of understand the other part. But I don't understand the late 30s. //The operator clearly remembers to make a whole number 39 // If you say 10, if 3 comes out, the value is smaller than 4, so I wonder how it comes out to be in your late 30s If there is an error or the price doesn't come out, it will be like that, but since the price of late 30s comes out, I understand more It didn't work...Please ㅜ

python function operator pandas

2022-09-22 12:23

1 Answers

The line below is executed.

else:
    return str (age // 10 * 10) + f "late to late"

If fstring {} You can put an expression in . We recommend that you change it as follows.

else:
    return f"{age // 10 * 10} late"


2022-09-22 12:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.