![]() |
|
Python help thread? - Printable Version +- Southperry.net (https://www.southperry.net) +-- Forum: Social (https://www.southperry.net/forumdisplay.php?fid=14) +--- Forum: Rubik's Cube (https://www.southperry.net/forumdisplay.php?fid=58) +--- Thread: Python help thread? (/showthread.php?tid=37777) |
Python help thread? - Alley - 2011-04-13 Fiel Wrote:Start with -1, not with 0 That works to make it horizontal, which is the biggest problem, but I'm still getting that pesky double front letter and the traceback. ![]() Code: Word: How in the world?Python help thread? - Fiel - 2011-04-13 Post your code again? Python help thread? - Alley - 2011-04-13 Also, appreciate the help. ![]() Code: def backwards_word(words):Python help thread? - Fiel - 2011-04-13 Comment out the while loop. >_>;;; Python help thread? - Alley - 2011-04-13 Fiel Wrote:Comment out the while loop. >_>;;; Alright, I broke the loop. Still showing that fucking double letter pomegranate though.. Python help thread? - Fiel - 2011-04-13 How is that possible? I commented it out on mine and it works fine. POST CODE Python help thread? - Alley - 2011-04-13 By commenting out you meant breaking the while, right? Code: def backwards_word(words):Python help thread? - Fiel - 2011-04-13 Nope. Use "#" before the lines. A # is a comment Code: def backwards_word(words):Python help thread? - Alley - 2011-04-13 Fiel Wrote:Nope. Use "#" before the lines. A # is a comment Hmm. Thanks! I have no clue why that works.. Time to do some research. Python help thread? - JPTheMonkey - 2011-04-13 Interestingly enough, this latest problem helps me with my new assignment: Palindromes. Have to check a file and check for perfect, imperfect, and no palindromes. Python help thread? - Alley - 2011-04-13 JPTheMonkey Wrote:Interestingly enough, this latest problem helps me with my new assignment: Palindromes. Have to check a file and check for perfect, imperfect, and no palindromes. That was one of the assignments in the reading I was doing. Weird. Python help thread? - JPTheMonkey - 2011-04-13 Alley Wrote:That was one of the assignments in the reading I was doing. Weird. ![]() I thought of SP when I checked out what was in the file we were checking for palindromes. "No sir away, there is a papaya war on." (Or very close to that, definitely had "papaya war"). Python help thread? - EarthAdept2 - 2011-04-18 I've been having some trouble trying to figure what I'm supposed to do for a portion of my program. More specifically, my program needs to be able to do "Markov Analysis." If the term doesn't seem familiar, it essentially means my program needs to be able to dissect a sentence (or paragraph) and reassemble it using its given prefixes and suffixes. For example, the sample sentence I put up: Quote:to be or not to be that is the question A prefix would be the word before the next word and the suffix is the one coming after. Ex. "be" is the prefix and "or" or "that" could be the potential suffix. Which is the part I'm having problems with, I don't really have an idea of how the reassembling part should be like. Here's my code thus far: Code: # Lab 9 - Markov AnalysisDisregard what I currently have under "def generate" since my code doesn't work but it's what I have thought up so far. "def analyze" should be already complete (but hey, if you can optimize it further go ahead!). If my explanation sucks butt, here's copypasta from the TA for the objective:
Markov Analysis
[Spoiler=General format of how "Generate" should work]Start with the given prefix Select at random a possible suffix that comes after this prefix (use random.choice([collection goes here]) to pick at random) Print or store the new word and use it to form a new prefix Repeat Now I don't think we're required to have it work with punctuation as well, but if you guys can get that to work too, I'd be really thankful. It'd really help with my learning process
|