create account

RE: Python practice tests by filler

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @emrebeyler/q041dt

· @filler ·
> return is a construction used in the code block of a function definition + after the return instruction is inserted the code block will stop executing anything so :

> def print_nums(x):
  for i in range(x): 
    print(i)
    return
print_nums(10)

> Program takes 0, verifies that is in range of 10 and prints 0
Because of the return statement program stops executing the code 

> If return is deleted from code the output will be
0
1
2
3
4
5
6
7
8
9
properties (22)
authorfiller
permlinkq04d3d
categorycoding
json_metadata{"app":"steemit/0.1"}
created2019-10-29 04:42:54
last_update2019-10-29 04:42:54
depth2
children2
last_payout2019-11-05 04:42:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length453
author_reputation4,924,532,976,740
root_title"Python practice tests"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,000,955
net_rshares0
@emrebeyler ·
That depends on the indentation:-)
👍  
properties (23)
authoremrebeyler
permlinkq04iem
categorycoding
json_metadata{"app":"steemit/0.1"}
created2019-10-29 06:37:36
last_update2019-10-29 06:37:36
depth3
children1
last_payout2019-11-05 06:37:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation448,535,049,068,622
root_title"Python practice tests"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,002,759
net_rshares5,554,864,179
author_curate_reward""
vote details (1)
@filler ·
The indentation went wrong because of improper markdown
properties (22)
authorfiller
permlinkq054xb
categorycoding
json_metadata{"app":"steemit/0.1"}
created2019-10-29 14:44:06
last_update2019-10-29 14:44:06
depth4
children0
last_payout2019-11-05 14:44:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation4,924,532,976,740
root_title"Python practice tests"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,013,261
net_rshares0