Help needed with FOR loops
#1
ayo there... currently started to learn python @ Codecademy.. almost 40% Done but this Fu**ing for loops got me stuck.. is there anyone who can explain me a bit better than codecademy offers? Thank you!
#2
Code:
for x in range(0, 3):
    print "number: %d" % (x)

Declare temp var x as 0, set limit at 3... meaning it will execute incrementally on 0, 1, and 2 (3 times)

Every time it completes one loop, print out "number: " and the current loop/increment/number

If you're familiar with the concept in other languages, it shouldn't be too hard to interpret.

Also: https://wiki.python.org/moin/ForLoop
Reply
#3
Is there anything specific regarding loops you don't understand?

https://wiki.python.org/moin/ForLoop This is understandable even with minimal background knowledge.
Reply
#4
(08-09-2016, 01:48 PM)Soap Wrote: Is there anything specific regarding loops you don't understand?

https://wiki.python.org/moin/ForLoop This is understandable even with minimal background knowledge.


i couldn't understand it in general.. tried re-doing it but without success.. is there any website where i can learn like Codecademy? (Python needed)
Reply
#5
(08-15-2016, 07:19 AM)dragonhunt3r Wrote:
(08-09-2016, 01:48 PM)Soap Wrote: Is there anything specific regarding loops you don't understand?

https://wiki.python.org/moin/ForLoop This is understandable even with minimal background knowledge.


i couldn't understand it in general.. tried re-doing it but without success.. is there any website where i can learn like Codecademy? (Python needed)

Why would you learn Python? What do you wanna do with it maybe I can recommend a other language and help you out with that.
Reply
#6
(08-16-2016, 01:29 PM)Coddr Wrote: Why would you learn Python? What do you wanna do with it maybe I can recommend a other language and help you out with that.

Python is flexible and can be incredibly powerful. It's an easy language for beginners to pick up, and it scales nicely.



dragonhunt3r, I'll try to get you a write-up that should explain it nicely when I'm not on my mobile.
Reply
#7
@Coddr as Albus mentioned, it an easy language and can be understood easily, Plus i believe that it's a powerful language and if i somehow master it who knows i might start offering coding service to vigilante and write some crazy stuff? Tongue Out

@Albus
that would be great m8.. thanks
Reply
#8
@Coddr no dis-respect but any other language without for loops (or anything similar) will take to back to COBOL, Assembly , Brainfuck or their cousins - Jump Stm. can make utter mess...
We use python everywhere right from backend of big websites like quora, youtube, major parts of google, instagram..., for doing simple research works in almost any comp. sci. field (take facebook's torch or google's tensorflow for eg.), python has libraries for anything, easy to learn syntax and fairly easy to scale.
Trust me you will thank lord if you have to edit someone else's HUGE C++ code to python code.
Reply
#9
(08-16-2016, 09:13 PM)loosekcha Wrote: @Coddr no dis-respect but any other language without for loops (or anything similar) will take to back to COBOL, Assembly , Brainfuck or their cousins - Jump Stm. can make utter mess...
We  use python everywhere right from backend of big websites like quora, youtube, major parts of google, instagram..., for doing simple research works in almost any comp. sci. field (take facebook's torch or google's tensorflow for eg.), python has libraries for anything, easy to learn syntax and fairly easy to scale.
Trust me you will thank lord if you have to edit someone else's HUGE C++ code to python code.

Lukely I'm not dealing to often with C++ or better say never. So that editing a HUGE C++ won't be a thing. I'm currently focusing Web Development since that took my intrests in the last year. So idk.. And I did Python before but don't like it, it so simple I mess with myself cause Im soo used to using curly brackets etc. Maybe ill take a look again to python If I need it for something so ill see.

EDIT: Ill take a look at it to do it for fun, but only if im capable to not confuse myself when I do other languages.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)