+ 1

Does anyone have any suggestions for someone trying to understand loops in python?

I've been studying python lately but Ive really had trouble understanding the different kinds of for loops and while loops and they're limitations. I haven't gotten much further in python than loops yet just an FYI.

20th Jun 2017, 9:29 PM
Ava Nicole
Ava Nicole - avatar
11 ответов
+ 4
you can use loops for many reasons.let me give you some examples 1-restarting any process even whole programme 2-creating arrays or lists even by user input 3- mostly for writing less code 4- printing things as necesary like invoices and its lines 5-force users to do things till they do it correctly 6-you can loop drawing things on screen may be sometimes forever (led messages work like that) etc etc etc
20th Jun 2017, 9:40 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 4
just one more example one set of cards - 12345678910JQK if you write full set you should write it 4 times and also lets imagine you add color in it so 13 x 4 x 2 for full deck of cards so you write loop to do that loop for colors: loop for types : loop for one set: very very less coding isnt it ?
20th Jun 2017, 9:50 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 4
loops saves time and coding and it also help you to control while doing it
20th Jun 2017, 9:57 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
20th Jun 2017, 9:54 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 3
here is a sample for csharp
20th Jun 2017, 9:55 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 2
let me give you real examples i read record from database then create invoice and i create invoice details by loops as many records i found in database by related record; loops save me writing many lines of code repeatedly
20th Jun 2017, 9:44 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 1
Do you have any suggestions for how to understand loops
20th Jun 2017, 9:41 PM
Ava Nicole
Ava Nicole - avatar
+ 1
Oh that I get. It's more specifically about the code itself
20th Jun 2017, 9:45 PM
Ava Nicole
Ava Nicole - avatar
+ 1
That loop is to sort the deck of cards?
20th Jun 2017, 9:52 PM
Ava Nicole
Ava Nicole - avatar
+ 1
Okay yeah it's kinda like sorting cards
20th Jun 2017, 9:55 PM
Ava Nicole
Ava Nicole - avatar
+ 1
Yup I get that
20th Jun 2017, 9:58 PM
Ava Nicole
Ava Nicole - avatar