How to return a value from a function?

前端 未结 5 1020
Happy的楠姐
Happy的楠姐 2021-01-28 21:39

Yes, I\'ve read tons of examples on this but I still don\'t get it.

I\'m learning Python and I made this script in order to help me understand how to \'return\':

5条回答
  •  孤独总比滥情好
    2021-01-28 21:55

    your variable "random" in def calc_pay_rise() was never assigned. Try:

    def calc_pay_rise():
        payrise = 5
        random = random_number()
        payrise = payrise + random
        print payrise
    

提交回复
热议问题