471,348 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Make a Word into Letters

Ok, I am a complete noob to programing. So in the script I was trying to write I needed to change a word like Cat or Dog. Into the letters 'C' , 'A' , 'T' or
'D' , 'O' , 'G'. I know how to use the 'split' command and I can to the basic stuff but please if your going to respond, make it easy to understand. Thanks

Ps. If your wondering I am making a Hangman game and I need the help to check the letters individually.
Sep 26 '07 #1
2 14226
ghostdog74
511 Expert 256MB
Ok, I am a complete noob to programing. So in the script I was trying to write I needed to change a word like Cat or Dog. Into the letters 'C' , 'A' , 'T' or
'D' , 'O' , 'G'. I know how to use the 'split' command and I can to the basic stuff but please if your going to respond, make it easy to understand. Thanks

Ps. If your wondering I am making a Hangman game and I need the help to check the letters individually.
read the tutorial on the python docs site.
Sep 26 '07 #2
bvdet
2,851 Expert Mod 2GB
Ok, I am a complete noob to programing. So in the script I was trying to write I needed to change a word like Cat or Dog. Into the letters 'C' , 'A' , 'T' or
'D' , 'O' , 'G'. I know how to use the 'split' command and I can to the basic stuff but please if your going to respond, make it easy to understand. Thanks

Ps. If your wondering I am making a Hangman game and I need the help to check the letters individually.
A word is an iterable.
Expand|Select|Wrap|Line Numbers
  1. >>> for letter in 'word':
  2. ...     print letter
  3. ...     
  4. w
  5. o
  6. r
  7. d
  8. >>> list('word')
  9. ['w', 'o', 'r', 'd']
  10. >>> 
Sep 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Case Nelson | last post: by
13 posts views Thread by Nige | last post: by
19 posts views Thread by pkilambi | last post: by
reply views Thread by Daniel Sayer | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.