-
Lesson 01/07 – Before We Begin [code lang=”python”] def answer (): return 42 [/code] Lesson 02/07 – Planning Your Trip [code lang=”python”] def hotel_cost (nights): return 140 * nights [/code] Lesson 03/07 – Getting There [code lang=”python”] def hotel_cost (nights): […]
Read More
-
Lesson 01/19 – What Good are Functions?! [code lang=”python”] def tax(bill): """Adds 8% tax to a restaurant bill.""" bill *= 1.08 print "With tax: %f" % bill return bill def tip(bill): """Adds 15% tip to a restaurant bill.""" bill *= […]
Read More
-
Lesson 01/06 – The datetime Library [code lang=”python”] from datetime import datetime [/code] Lesson 02/06 – Getting the Current Date and Time [code lang=”python”] from datetime import datetime now = datetime.now () print now [/code] Lesson 03/06 – Extracting Information […]
Read More
-
Lesson 01/16 – Strings [code lang=”python”] Set the variable brian on line 3! brian = “Hello life!” [/code] Lesson 02/16 – Practice [code lang=”python”] Assign your variables below, each on its own line! caesar = “Graham” praline = “John” viking […]
Read More
-
Lesson 01/05 – The Meal [code lang=”python”] Assign the variable meal the value 44.50 on line 3! meal = 44.50 [/code] Lesson 02/05 – The Tax [code lang=”python”] meal = 44.50 tax = 0.0675 [/code] Lesson 03/05 – The Tip […]
Read More
-
Lesson 01/11 – Break It Down [code lang=”python”] [/code] Lesson 02/11 – Ahoy! (or Should I Say Ahoyay!) [code lang=”python”] print ("Welcome to the English to Pig Latin translator!") [/code] Lesson 03/11 – Input! [code lang=”python”] print ("Welcome to the […]
Read More
-
Lesson 01/13 – Welcome! [code lang=”python”] print "Welcome to Python!" [/code] Lesson 02/13 – Variables [code lang=”python”] Write your code below! my_variable = 10 [/code] Lesson 03/13 – Booleans [code lang=”python”] Set the variables to the values listed in the […]
Read More
-
Lesson 01/15 – Go With The Flow [code lang=”python”] def clinic(): print "You’ve just entered the clinic!" print "Do you take the door on the left or the right?" answer = raw_input("Type left or right and hit ‘Enter’.").lower() if answer […]
Read More