# data[].attributes.body
download and this!!

# data[].attributes.attachment_link.readable_text
"""
    Try not to refer to this file all the time. You want to eventually memorise this stuff
    so that you can code more quickly and not have to think about the basics when solving
    a complex problem.

    To make things easier to read, I've numbered the print statements as tx and made it so that you
    can easily select which sections you want to print by changing display

    I encourage you to play with this code. Make changes to it and see what happens!!
"""

#change this to choose which section you want to print out
display = 3

#----------------------------------------------------------------------------------------------------------
#   printing
#----------------------------------------------------------------------------------------------------------

if display == 0:

    #easiest way to print a blank line
    print ("t1")
    print ()

    #print on multiple lines with multiple statements
    print ("t2")
    print ("hello")
    print ("world")

    #print on multiple lines with one print statement
    print ("t3")
    print ("hello\nworld")

    #multiple print statements on one line
    print ("t4")
    print ("hello ", end="")
    print ("world")


#----------------------------------------------------------------------------------------------------------
#   lists
#----------------------------------------------------------------------------------------------------------

elif display == 1:

    #how to create an empty list and add stuff to it
    #insert() adds in any position; append() adds only at the end
    print ("t1")

    pets = []

    pets.append("dog")
    pets.append("cat")
    pets.insert(1, "fish")
    print (pets)

    #how to remove from a list by position
    print ("t2")

    pets.pop(2)
    print (pets)

    #how to remove from a list by item
    print ("t3")

    pets.remove("dog")
    print (pets)

    #how to create a non-empty list
    print ("t4")

    morePets = ["rat", "parrot", "shark"]
    print (morePets)


#----------------------------------------------------------------------------------------------------------
#   tuples and lists of tuples
#----------------------------------------------------------------------------------------------------------

elif display == 2:

    #how to create tuples
    print ("t1")

    gameName = "factorio"
    genre = "base building"
    isInstalled = True
    game1 = (gameName, genre, isInstalled)

    gameName = "cities skylines"
    genre = "city builder"
    isInstalled = True
    game2 = (gameName, genre, isInstalled)

    print (game1)
    print (game2)

    #how to create a list of tuples
    print ("t2")

    myGames = [game1, game2]
    print (myGames)

    #how to add tuples to a list directly (don't forget the extra brackets!)
    print ("t3")

    gameName = "morrowind"
    genre = "RPG"
    isInstalled = False

    myGames.append((gameName, genre, isInstalled))
    print (myGames)

    #accessing tuples
    print ("t4")

    #how to access a list element
    print (myGames[1])
    #how to access a tuple element
    print (game2[0])
    #how to access a tuple element in a list of tuples
    print (myGames[1][0])


#----------------------------------------------------------------------------------------------------------
#   range() and for loops
#----------------------------------------------------------------------------------------------------------

elif display == 3:

    #remember: range() counts from 0 by default so these are the same
    print ("t1")

    for i in range(3):
        print (i)

    for i in range(0, 3):
        print (i)

    """
        for statements are probably one of the hardest concepts in the course. Should have
        spent more time on them. Sorry!!! 

        within a for statement, i can mean two different things
    """
    print ("t2")

    animals = ['cat','dog','rat']

    #here i iterates through some integers
    for i in range(len(animals)):
        print (i)

    #here i iterates through the object itself
    for i in animals:
        print (i)

    """
        basically, i just goes through (stores the values of) whatever is given to it 
        after "in". if you give it a range object, it will have a bunch of numbers to 
        go through. if you give it a list, it will have whatever is in the list to go 
        through. you can use the numbers from a range as indices to access the list anyway, 
        so you only really need the first method.
    """
    print ("t3")

    for i in range(len(animals)):
        print (animals[i])

    """
        also, i is just a variable name to stand for the stuff you are cycling through.
        you can change it to anything
    """
    print ("t4")

    for animal in animals:
        print (animal)

    for index in range(len(animals)):
        print (animals[index])


    #so there are two ways to remove a tuple from a list
    print ("t5")

    opposites = [("hot", "cold"), ("good", "evil"), ("up", "down")]

    for i in opposites:
        if i[0] == "up":
            opposites.remove(i)
    print (opposites)

    for i in range(len(opposites)):
        if opposites[i][0] == "good":
            opposites.pop(i)
            break
    print (opposites)

    """
        if you don't add in the break you will get an out-of-range error because you shortened the list
        but are still counting to it's original length
    """

# data[].attributes.body
https://codeshare.io/

# data[].attributes.attachment_link.title
Sublime Text - the sophisticated text editor for code, markup and prose

# data[].attributes.headline
A set of python modules for making games and other graphical applications

# data[].attributes.subject
A set of python modules for making games and other graphical applications

# data[].attributes.attachment_link.readable_text
Over the next weeks we have plenty of game jams that people from the pygame communities take part in.

The pygames hackathon runs from March 20th, 2023 to April 17th 2023, and is open to people in USA and Canada. For this one there's $12,700 in prizes. "If you love programming and gaming, this is the perfect opportunity to showcase your skills and have some fun!"

Then the must-use-python PyWeek challenge "Invites entrants to write a game in one week from scratch either as an individual or in a team. Is intended to be challenging and fun. Will hopefully increase the public body of python game tools, code and expertise. Will let a lot of people actually finish a game, and may inspire new projects (with ready made teams!)." PyWeek runs from March 26nd, 2023 to April 2nd 2023, and theme voting is already on.

Finally, Ludum Dare is an event where you create a game from scratch in a weekend based on a theme. April 28th, 2023. Starts at 3:00 AM CEST *. Ludumdare is the oldest online game jam, and has the largest number of participants. There is a Jam (72h, less restrictive rules), and a compo (48h more rules). The Jam now lets people submit paper board games, and even things like crafts that aren't games at all!

# data[].attributes.attachment_link.description
Over the next weeks we have plenty of game jams that people from the pygame communities take part in. The pygames hackathon runs from March 20th, 2023 to April 17th 2023, and is open to people in USA and Canada. For this one there's $12,700 in prizes.