Hi
I want to create a program to capitalize each character of a sentence for one second and then move to the next.
For example: "hello brian"
First H should be capitalized for one second and then e and then l and so on.
I think it is good for learning Python
Can anyone help?
You're right, it's a good exercise, so what you've done so far.
Hello,
yes it sounds like a fun way to tinker with Python. Have you already learned about loops?
You can solve the task in quite a simple way by using a loop, time.sleep and string upper() method.
Yeah, I know loops and time.sleep.
But I don't know how to put it all together.
Give it a try and let's continue from there.
Which python tutorial do you use btw?
Hello!
See string.capwords() method.
>>> import string
>>> s = "hello brian"
>>> string.capwords(s)
'Hello Brian'
>>>
Aaaa, sorry! You want to capitalize each character in the string. Ignore this snipped
So far I have tried this:
Quote:text = "Welcome to my Program"
for a in text:
print(a)
It shows the contents of the file in a vertical format.
(Jan-27-2017, 12:23 AM)wavic Wrote: [ -> ]Hello!
See string.capwords() method.
>>> import string
>>> s = "hello brian"
>>> string.capwords(s)
'Hello Brian'
>>>
Aaaa, sorry! You want to capitalize each character in the string. Ignore this snipped
If this was the expected outcome from the OP, you could of just used the title method since a string is in of itself an object.
>>> "hello brian".title()
'Hello Brian'