kelefi
Badges: 19
Rep:
?
#1
Report Thread starter 6 years ago
#1
i have started python and need some help:
how do i make a spelling program e.g input a word and python prints each individual letter.
e.g
input = carrot
C
A
R
R
O
T
thanks for the help and also; what cool tricks are there in python?? thanks!
0
reply
roblee
Badges: 2
Rep:
?
#2
Report 6 years ago
#2
You'll use a foreach loop for that:

Code:
word = "CARROT" # raw_input()
for letter in word:
  print letter
The "cool" things that people always talk about in Python are list-comprehensions and generators, something to have a search for.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Have you made up your mind on your five uni choices?

Yes I know where I'm applying (115)
66.47%
No I haven't decided yet (35)
20.23%
Yes but I might change my mind (23)
13.29%

Watched Threads

View All