[Tutor] Beginners question
Alan Gauld
alan.gauld at yahoo.co.uk
Mon Mar 30 20:38:58 EDT 2020
On 30/03/2020 22:11, Michael Langdon wrote:
> My input.
> a = input("Enter a word: ")
> sentence = sentence , a
> while a != ("quit"):
> sentence = sentence , a
> a = input("Enter a word: ")
> print(sentence)
As you can see your code has lost all indentation.
To avoid this you *must* post in plain text
BTW You don't need the second line, it is not really
doing anything (In fact I'd expect it to give an error
since you are assigning sentence before creating it!)
> My output.
> Enter a word: orange
> ((), 'orange')
> Enter a word: apple
> (((), 'orange'), 'orange')
> Enter a word: quit
> ((((), 'orange'), 'orange'), 'apple')
>
>
> Can you help me with this?
I'm not sure what you expect? The program is
doubless doing exactly what you told it to do.
What did you want it to do differently?
I can guess but it is better if you explain it to us
(you might even figure out the issue as you explain
it!)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list