Codecademy offers a 7 day trial period and I immediately started the Python 10 hour course. The platform is useful and consists of three panes: instructions and examples, script editor, and the console showing the results of the script.
Within an hour or so, I was able to write a short Mad Libs script, which worked in the Codecademy console:
""" This program generates passages that are generated in a cool mad-lib format Author: Johan """ # The template for the story is below STORY = "This morning %s woke up feeling %s. 'It is going to be a %s day!' Outside, a bunch of %s were protesting to keep %s in stores. They began to %s to the rhythm of the %s, which made all the %ss very %s. Concerned, %s texted %s, who flew %s to %s and dropped %s in a puddle of frozen %s. %s woke up in the year %s, in a world where %ss ruled the world." print "Mad Libs has started!" name = raw_input("Enter a Name: ") adj1 = raw_input("Enter an adjective: ") adj2 = raw_input("Enter a second adjective: ") adj3 = raw_input("Enter a third adjective: ") verb = raw_input("Enter a verb: ") noun1 = raw_input("Enter a noun: ") noun2 = raw_input("Enter another noun: ") animal = raw_input("Enter an animal: ") food = raw_input("Enter a food: ") fruit = raw_input ("Enter a fruit: ") superhero = raw_input ("Enter a superhero: ") country = raw_input ("Enter a country: ") dessert = raw_input ("Enter a dessert: ") year = raw_input ("Enter a year: ") print STORY % (name, adj1, adj2, animal, food, verb, noun1, fruit, adj3, name, superhero, name, country, name, dessert, name, year, noun2)
I wanted to save the code in a console so that people could run it. I created this Kaggle kernel (open only on desktop). Kaggle is a site where you can store and run your code and share with others. However, when I ran it I got an error. Turns out Kaggle runs Python 3 and the Codecademy course is teaching me Python 2…
Note to self (and you all): decide if you need Python 2 or 3. Considering I’m expecting to do a lot in Kaggle, I think I need Python 3. Back to finding an appropriate Python course.