[#CodeMonkeys] Free Coursera course on Python

18 views
Skip to first unread message

Mark Turnage

unread,
Oct 15, 2012, 2:20:46 PM10/15/12
to Midsouth Makers Public List
http://www.coursera.org/course/interactivepython

Since several people have mentioned python in the group, I think folks
might want to to consider signing up for this. It's a free, 8-week
course.

--
Mark Turnage

MemphisArtGuy

unread,
Oct 16, 2012, 8:50:16 AM10/16/12
to midsout...@googlegroups.com
Started the 15th, but it still allowed me to sign up.

-Dru

MemphisArtGuy

unread,
Oct 20, 2012, 5:18:09 PM10/20/12
to midsout...@googlegroups.com
 Hey Mark, any luck on the first assignment?

I end up writing this simple version to figure out what they were looking for. It was enough for me to figure out the rest. I really didn't figure out till later that they were looking to have the human defined by the calls to the RPSLS 

Anyway if you get stuck this is enough to figure it out with out breaking the honor code.


--------------code--------------------------------- 

import random

def Num2Card(player_number):
 if (player_number == 0):
  pc = "Rock"
 elif (player_number == 1):
  pc = "Spock"  
 elif (player_number == 2):
  pc = "paper"
 elif (player_number == 3):
  pc = "lizard"
 elif (player_number == 4):
  pc = "scissors"
 return (pc)

player_number = random.randrange(5)
comp_number = random.randrange(5)

print ""
print "MAC chooses", Num2Card(player_number) #, player_number
print "PC chooses", Num2Card(comp_number) #, comp_number

if ((player_number - comp_number) % 5 > 2):
    print "MAC wins!"
elif ((player_number - comp_number)) % 5 == 0:
    print "MAC and PC tie!"
elif ((player_number - comp_number) % 5 < 3):
    print "PC wins!"    

player_number = random.randrange(5)
comp_number = random.randrange(5)


--------------code--------------------------------- 

Mark Turnage

unread,
Oct 20, 2012, 6:15:22 PM10/20/12
to midsout...@googlegroups.com
It was fairly easy once I worked my brain around it. The trick is to
look at all the difference between the two choice variables mod 5.
You'll notice a definite pattern for the winning and losing matches.
Just do a conditional based on that.

MemphisArtGuy

unread,
Oct 20, 2012, 11:44:33 PM10/20/12
to midsout...@googlegroups.com
Yeah I over simplified it. That was a pain to pull apart.

Mark Turnage

unread,
Oct 21, 2012, 1:21:05 AM10/21/12
to midsout...@googlegroups.com
Oddly enough, this one assignment proved the worth of taking a course I thought might be too basic: I discovered that the way python handled modulus is _different_ from the way the C based languages do it (quick version: negatives are sometimes different), and much more mathematically correct. Showed me just how much of a hole I have on the math side of things (my degree is in physics, and there was surprisingly little overlap with the math required for comp sci).

Depending on how my week goes I might be able to meet up for an hour or two at the space this week about the next assignment. I'll let you know.

Sent from my iPhone

MemphisArtGuy

unread,
Oct 23, 2012, 9:17:24 AM10/23/12
to midsout...@googlegroups.com
Do let me know I'm gonna take a look at it tonight. 
 
  Some of the math stuff they were pulling was way over my head. With that said the end project looks like a JukeBox I made for my interactive multimedia class I took at MCA except we were using Lingo in Director. It was a space game, where you could blow up certain items, drag items with a tractor beam, and I attached a list of 3 relevant mp3's to the item to every item that was the JukeBox. It was pretty good cause I had to set a scroll speed for the background and the items in the fore ground, they of course couldn't be the same since things further away appear to be moving faster. the real appeal was all the items were 3D rendered using alpha channels so they over layed perfectly. 

Be intresting to see how far we get in this class. Be cool if I could remake that game in Python since shockwave has falled out of favor and Director is all but dead.

-Dru

Hart

unread,
Nov 11, 2012, 1:18:19 PM11/11/12
to midsout...@googlegroups.com
Would anyone taking the course be able to tell me how they are teaching event handling and game making? Are you guys learning with pygame? I'm interested but busy with my own python project right now

MemphisArtGuy

unread,
Nov 12, 2012, 5:49:13 PM11/12/12
to midsout...@googlegroups.com
Learing with thier own system which means I have no idea how much of this can be used else where. Mark was thinking of dropping it, and I have pretty much fallen to far behind due to illness. I have notice while its has been some what frustrating to me, I have become a better coder with The Arduino. Infact as much as it was over my head, a snippet of code I picked up from the Python Group got the bubble bot up and working. I meant to post the code this weekend but health issues still plague me.

-Dru   
Reply all
Reply to author
Forward
0 new messages