May-07-2017, 11:28 AM
(This post was last modified: May-07-2017, 11:28 AM by ichabod801.)
You're starting at the top. You've got the framework listed in the last bullet point without the pieces listed in the first two parts. Start at the bottom, and write the first two parts.
First you need to convert the string input to a list. From the description, your input is going to look like this:
Then write the checkWork (checkWord?) function as described. You are going to want to loop through the list of lists like this:
First you need to convert the string input to a list. From the description, your input is going to look like this:
Output:adress:address
alot:a lot
athiest:atheist
noone:no one
Convert that text into a list of lists as specified. Point 1 spells out exactly how to do it.Then write the checkWork (checkWord?) function as described. You are going to want to loop through the list of lists like this:
e = [[2, 7], [1, 8], [2, 8]] for first, second in e: print(first + second)This is called tuple assignment. The first time through the loop, it will pull the sub-list [2, 7] out of e, and assign that to
first, second
, sort of like this:first, second = [2, 7]Python can handle having two items on the left of the assignment, as long as two items are on the right. It will assign the 2 to first and the 7 to second.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures