![]() |
|
#1
|
|||
|
|||
Loops and stringshello.I'm quite new to the python language and I'm trying to write a simple program which gets a sentence and print the number of digits,vowels,spaces and other chars.I've written a program but it doesn't work.
can you tell me where is the problem and maybe dirrect me to a good tutorial. this is my code so far: Python Code:
Last edited by LuciWiz : 25-Dec-2008 at 18:33.
Reason: Replaced [cpp] tags with [py] tags
|
|||
|
#2
|
|||
|
|||
Re: loops and stringsQuote:
If you don't have a textbook (or, maybe, even if you do), you might start here: http://docs.python.org/tutorial/ Quote:
So far, you haven't written an if statement with even one condition. From the tutorial: "An informal Introduction...->First Steps Towards Programming "The body of the loop is indented: indentation is Python’s way of grouping statements. " So: Python Code:
Note the proper form of the "if" statement giving a range as i takes on values from the the value of the first argument up to but not including the value of the second argument. Regards, Dave Last edited by davekw7x : 25-Dec-2008 at 11:32.
|
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Whats wrong? Using a function in strings. | 8100 Power | C++ Forum | 2 | 16-Oct-2008 15:46 |
| How to sort in C++ alphabetically | wilen | C++ Forum | 5 | 20-Apr-2007 14:43 |
| Storing strings in an array... | MSUracer | C++ Forum | 27 | 21-Oct-2006 01:24 |
| Menu of character strings | aijazbaig1 | C Programming Language | 21 | 27-Jul-2006 03:07 |
| Dynamic memory, loops, and segmentation faults | ubergeek | C++ Forum | 2 | 07-May-2005 16:53 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The