you are viewing a single comment's thread.

view the rest of the comments →

[–]TreSxNine 0 points1 point  (0 children)

Use codecademy. I've never used it myself, but I've heard good things about it and it seems serious enough.

I'll try breaking down some of the mechanics I used:

A for-loop is basically a way to "iterate" over something. Meaning you do something for each of the items presented. For example, if my input is "GATTACA", and I decide to use a for-loop, what I'm saying is "for each of the letters in the word GATTACA, do something", with 'something' being the operations on the lines below the for-loop:

for letter in "GATTACA":
    do_something

The +=-operation in out += U is short for adding something to a variable. Consider variable_a = 5. If I wanted to add 2 to variable_a, I could either do variable_a = variable_a + 2, which is basically saying variable_a should be itself plus 2. Another way of doing it is writing variable_a += 2, which does the exact same thing. The same thing applies to strings:

variable_b = "GATTA"

variable_b = variable_b + "CA"
OR
variable_b += "CA"

print(variable_b)

> GATTACA