|  | |
02-16-2008, 09:56 PM
|
#31 (permalink)
|
Ultra Techie Join Date: Jan 2007 Location: North Carolina Posts: 994
| Re: help lol it is pretty cool. i got the idea from another snippet that i saw that was kinda like it and i modified it to what i knew and changed some stuff. and i came up with a simple one that scrambled the word "dictionary" it has to do with strings and assigning the order of the letteres differently by the different numbers like 0 is the first letter in a string. so you would just mix up the numbers in the string like
aStr= "to"
astr[0]+astr[1]
that would leave it as to
but change the 1 and the 0 so the 1 is first and you get
ot
and its just doing that and assigning it a variable and prompt for user input and if it was right or wrong and how many tries. thats what it does but many times over for different words.
note: you will have to manually scramble it i haven't figured out a randomization scramble yet.
__________________ Quote:
Originally Posted by Oreo That was an epic forum speech, Doom is tech-forums very own Martin Luther King. | Don't Tell any one but I know who Crunch is... I Do accept support requests via PM, MSN, and e-mail  If I have been helpful to you in any way please click the scale under my name |
| |
02-16-2008, 09:59 PM
|
#32 (permalink)
|
FPS Addict Join Date: Dec 2007 Location: Fonthill, Ontario, Canada Posts: 4,262
| Re: help that is pretty cool, it seems like alot of code for just a scrambling program, how long did it take u.
Edit: i am looking at it, i think i could edit a bit but nothin that would really change it, i havn't learned anything about user input yet so hopefully i will soon.
__________________ <<<<If you found me helpful in anyway, or enjoy my posts then click the checkmark<<<< |
| |
02-16-2008, 10:03 PM
|
#33 (permalink)
|
Ultra Techie Join Date: Jan 2007 Location: North Carolina Posts: 994
| Re: help yea this is just what one scrambled word looks like Code: number = aStr = "dictionary"
answer = ''
print'Descramble this word!!'
print aStr[3] + aStr[6] + aStr[1] + aStr[5] + aStr[0] + aStr[9] + aStr[2] + aStr[8] + aStr[4] + aStr[7]
attempts = 0
while answer != number:
answer = raw_input( '?' )
attempts = attempts + 1
if( answer > number ):
print 'Try Again'
elif( answer < number ):
print 'Wrong'
elif( answer == number ):
print 'you got it rights in %i tries!' %(attempts)
just to make it simpler i just cut it down to one so you can look at it and understand the little pieces of it.
trust me it will takes some time this code took me about 2 days to figure out just that one little bit. but after i got that all i had to do was repeat it and switch the numbers of the strings for the different words and give them different variable names.
__________________ Quote:
Originally Posted by Oreo That was an epic forum speech, Doom is tech-forums very own Martin Luther King. | Don't Tell any one but I know who Crunch is... I Do accept support requests via PM, MSN, and e-mail  If I have been helpful to you in any way please click the scale under my name |
| |
02-16-2008, 10:08 PM
|
#34 (permalink)
|
FPS Addict Join Date: Dec 2007 Location: Fonthill, Ontario, Canada Posts: 4,262
| Re: help by what u just told me about scrambling the letter i was able to do this:
lefe="stealth"
print lefe[0] + lefe[3] + lefe[1] + lefe[2] + lefe[4] + lefe[6] + lefe[5]
it just scrambles the letter though (no input) but u know that, im gona look at ur code for a few mins to see if i can figure it out.
__________________ <<<<If you found me helpful in anyway, or enjoy my posts then click the checkmark<<<< |
| |
02-16-2008, 10:10 PM
|
#35 (permalink)
|
Ultra Techie Join Date: Jan 2007 Location: North Carolina Posts: 994
| Re: help yea and when you get into doing the bigger codes and pasting them here in the forums be sure to use the code tags like [code] and the corosponding end
im here to help you if you come across problems.
__________________ Quote:
Originally Posted by Oreo That was an epic forum speech, Doom is tech-forums very own Martin Luther King. | Don't Tell any one but I know who Crunch is... I Do accept support requests via PM, MSN, and e-mail  If I have been helpful to you in any way please click the scale under my name |
| |
02-16-2008, 10:37 PM
|
#36 (permalink)
|
FPS Addict Join Date: Dec 2007 Location: Fonthill, Ontario, Canada Posts: 4,262
| Re: help man, i have been trying to figure it out but im totally lost, im gona try to get a couple more lesson done to night, maybe that will help. i tryed just changing the word and the word scrabling stuff in ur code but it didn't work, there was a synax error. im guessing python can't be used to make programs (when i say programs i mean something that u start and its not in the cmd.
EDIT: what do u mean by code tags?
__________________ <<<<If you found me helpful in anyway, or enjoy my posts then click the checkmark<<<< |
| |
02-16-2008, 10:41 PM
|
#37 (permalink)
|
Ultra Techie Join Date: Jan 2007 Location: North Carolina Posts: 994
| Re: help na. say you have 14 letters in a word you'd only have 14 astr[#] of those and each would have a number. and you need to keep the variables te same like when you specifie what the string is also called so you can keep that for comparison to the user's input. see where number = astr ba bla bla bla yo uget it
that means that that word is also stored in the variable number so yo ucan use that for comparison to their answer and its essential you keep that variable the same. look for more times i use number in that code and you'll see the pattern.
post what you have here in code tags.
__________________ Quote:
Originally Posted by Oreo That was an epic forum speech, Doom is tech-forums very own Martin Luther King. | Don't Tell any one but I know who Crunch is... I Do accept support requests via PM, MSN, and e-mail  If I have been helpful to you in any way please click the scale under my name |
| |
02-16-2008, 10:48 PM
|
#38 (permalink)
|
FPS Addict Join Date: Dec 2007 Location: Fonthill, Ontario, Canada Posts: 4,262
| Re: help Code: Quote:
lefe="stealth"
answer = ''
print 'descramble this word'
print lefe[0] + lefe[3] + lefe[1] + lefe[2] + lefe[4] + lefe[6] + lefe[5]
attemps = 0
while answer !=number:
answer = raw_input( '?' )
attempts = attempts + 1
if( answer > number ):
print 'try again'
elif( answer < number ):
print 'wronge'
elif( answer == number ):
print 'you got it right!!' %(attempts)
| im not sure really what ur talking about. that all i have and o took most of it from ur code.
__________________ <<<<If you found me helpful in anyway, or enjoy my posts then click the checkmark<<<< |
| |
02-16-2008, 10:53 PM
|
#39 (permalink)
|
Ultra Techie Join Date: Jan 2007 Location: North Carolina Posts: 994
| Re: help okay i see 2 things wrong here. one you dont have number specified so change the first line to be
number = lefe = "stealth"
and problem 2 is that when you put down answer you need to leave a space so its like this
answer = ' '
edit: 3 things now
at the end you need to have the i% so change the bottom line to be
print ' you got it right!! in %i tries! ' %(attempts)
__________________ Quote:
Originally Posted by Oreo That was an epic forum speech, Doom is tech-forums very own Martin Luther King. | Don't Tell any one but I know who Crunch is... I Do accept support requests via PM, MSN, and e-mail  If I have been helpful to you in any way please click the scale under my name
Last edited by DawnOfDoom; 02-16-2008 at 10:55 PM.
|
| |
02-16-2008, 11:02 PM
|
#40 (permalink)
|
FPS Addict Join Date: Dec 2007 Location: Fonthill, Ontario, Canada Posts: 4,262
| Re: help it still didn't work. im kinda getting discouraged because in the tuturial it doesn't explain lists very good and i don't get them, do u know of any other tuturials that might be esier to understand.
EDIT: i found a tutorial that explains lists well and inputafter u write the program, im gona try to write something, then i'll post it
EDIT: well i kinda stoll someones idea but this is it, extreamily simple compared to urs but it a step forward for me: Quote:
print "Halt!"
s = raw_input("Who Goes there? ")
print "You may pass,",s
|
__________________ <<<<If you found me helpful in anyway, or enjoy my posts then click the checkmark<<<<
Last edited by Luke; 02-16-2008 at 11:20 PM.
|
| |  | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |