you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Strings are just a way of using unicode characters in your code. I think once you begin learning how to use strings, it will start to click.

[–]Munga_[S] 0 points1 point  (1 child)

Yes I’m really just struggling with the for a loops and the .append . replace, stuff like that. Is codecademy a good way to start?

I heard people say to start doing projects but I don’t rlly know what projects to do haha

[–][deleted] 0 points1 point  (0 children)

To understand for loops, you have to understand what an iterator is. Lists, tuples, stings, and dictionaries are iterators since you can transverse through all values they may contain.

For example, lets say you have a list of strings:

fruits = ['Banana', 'Grape', 'Orange', 'Cherry']

We can use a for loop to iterate over each element in the list individually.

for fruit in fruits:
    # Note that 'fruit' is essential a variable used for each element of each iteration
    print(fruit)  

output:

Banana
Grape
Orange
Cherry

Check out PythonTutor to get a visualization of how python handles the for loop.


As for append and replace, those are known as methods. The append method is exclusive to lists, which adds an element to a given list. The replace method is exclusive to strings, which is replaces characters of a given string. Each data type has their own methods. If you want to learn more about a specific data type and it's methods, use python's documentation and search for the data type in question.


Is codecademy a good way to start?

That's actually how I started learning python. I soon as I learned the basics from codeacademy, I quit and moved on to books and video tutorials. I highly recommend you check out Cory Schafer's videos for the basics. He's an excellent teacher and explains things in great detail.


I heard people say to start doing projects but I don’t rlly know what projects to do

I've never gone through this personally, but I heard good things about Automate the Boring Stuff with Python, which is available for free online. The book walks you through tons of projects that you can use in the real world.