create account

RE: Learn Basic Python Programming EP.3. - Logic & Loops by profitgenerator

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

Viewing a response to: @ragequit/re-profitgenerator-learn-basic-python-programming-ep-3-logic-and-loops-20170630t131358289z

· @profitgenerator ·
I didnt quite understood what is the difference between foreach and for, I believe it can iterate other things too not just numbers.

Also keep in mind that I have like medium knowledge about python, I have not much experience with using classes and other objects , I have to learn more about those. But I will touch functions and other basic things in this tutorial.
properties (22)
authorprofitgenerator
permlinkre-ragequit-re-profitgenerator-learn-basic-python-programming-ep-3-logic-and-loops-20170630t131616200z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-30 13:16:36
last_update2017-06-30 13:16:36
depth2
children1
last_payout2017-07-07 13:16: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_length367
author_reputation68,549,319,463,075
root_title"Learn Basic Python Programming EP.3. - Logic & Loops"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id6,759,576
net_rshares0
@ragequit ·
Explaining to others is a great way of making sure you understand something, it's a good thing to do once you feel like you master something. It also helps you figure out what you don't understand that well and look over it again.

The idea is that Python doesn't have a foreach syntax like other languages, instead the for loop works like a foreach would. If you have no idea what I'm talking about don't stress it, it's just a tip for whoever is coming from another language that has the classic for loop
>for (element = 0; element < list; element++)

 to remember that python's <strong>for</strong> is actually a foreach 
>for~~each~~ element in list:
___do stuff
properties (22)
authorragequit
permlinkre-profitgenerator-re-ragequit-re-profitgenerator-learn-basic-python-programming-ep-3-logic-and-loops-20170630t133146213z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-30 13:31:48
last_update2017-06-30 13:31:48
depth3
children0
last_payout2017-07-07 13:31:48
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_length666
author_reputation84,968,448,410
root_title"Learn Basic Python Programming EP.3. - Logic & Loops"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id6,761,226
net_rshares0