Skip to content

Forum in maintenance, we will back soon 🙂

Notifications
Clear all

Loop python

7 Posts
3 Users
1 Reactions
29 Views
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

 

please don't skip any things when you teach something..

 

what key did you put to make it simple?

 

counter = counter + 1

counter += 1

 

 
Posted : 07/11/2023 12:07 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

sorry, what did I skip?

what exactly is not clear here?

 
Posted : 07/12/2023 10:46 am
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@admin 

which key did you put to make it short?

 

counter = counter + 1 -> counter += 1

 

 
Posted : 07/12/2023 12:50 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 
(@jay-kim) You can't get any simpler. What don't you understand? If you can't understand this simple piece of code then you'll not be able to continue with learning how to code.
 
We set a variable named counter to an initial value of 1
then we create a loop that evaluates the value of the variable counter and while it is less than or equal to 10 we add 1 to the variable counter.
The loop stops when the variable counter reaches the value of 11.
 
There are two ways to increment (add to) the variable counter and both have the same result:
 
1) >>> counter = counter + 1  ### Add 1 to the value of counter and store it back into the variable counter.
2) >>> counter += 1  ### Shorthand method that evaluates to the same as the first method.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/12/2023 5:40 pm
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@ssadvisor what I asked was just how to make it short with keyboard.. 

 

totally agree with you. have to know from the scratch to make it done. but now not sure I could get what he said.. 

 
Posted : 07/14/2023 1:01 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@jay-kim You just type it shorter; no keyboard tricks.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/16/2023 12:00 am
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@ssadvisor so my question is how...

 

have to do something to make it short I think.

 
Posted : 07/16/2023 8:07 am
Share:
[the_ad_group id="312"]