On 02/06/15 17:25, Stephanie Quiles wrote:
What is the +k+ called? How exactly does it work? I'm a big confused on that...
You seem to be replying to the wrong post.
I assume you mean this one from Joel?
-
>> for k in capitals.keys():
>> state = input('Enter the
On 02/06/15 17:17, Peter Otten wrote:
choice = input('Do you want to play again y/n: ')
if choice.upper() == 'N':
print('end of game')
break
elif choice.upper() != 'Y':
print("invalid choice")
Y goes round again silently.
What is the +k+ called? How exactly does it work? I'm a big confused on
that...
Stephanie Quiles
Sent from my iPhone
> On Jun 2, 2015, at 12:17 PM, Peter Otten <__pete...@web.de> wrote:
>
> Alan Gauld wrote:
>
>>> On 02/06/15 15:15, Peter Otten wrote:
>>>
>>> Not an optimization, but if the
Alan Gauld wrote:
> On 02/06/15 15:15, Peter Otten wrote:
>
>> Not an optimization, but if the user enters neither Y nor N you might ask
>> again instead of assuming Y.
>
> He does. He only breaks if the user enters N
>
>>> choice = input('Do you want to play again y/n: ')
>>>
On 02/06/15 09:45, ZBUDNIEWEK.JAKUB wrote:
I'm a newbie, but was able to tune it to correctly reply to user inputs.
1. My question is can it be optimized in any way?
Code can nearly always be optimised.
Whether it is worth doing so depends on the need to do so.
In this case I douybt its worthwh
On 02/06/15 15:15, Peter Otten wrote:
Not an optimization, but if the user enters neither Y nor N you might ask
again instead of assuming Y.
He does. He only breaks if the user enters N
choice = input('Do you want to play again y/n: ')
if choice.upper() == 'N':
On 02/06/15 15:50, Stephanie Quiles wrote:
> So basically, what I did wrong was the indentation?
Yes.
In Python indentation is all important.
When you write a for (or while) loop Python executes all the
indented code under the opening loop statement. When it sees
an unindented statement it reads
Thank you all for your help! I have a text today but I am not confident with
this. So basically, what I did wrong was the indentation?
Thanks
Stephanie Quiles
Sent from my iPhone
> On Jun 2, 2015, at 10:15 AM, Peter Otten <__pete...@web.de> wrote:
>
> ZBUDNIEWEK. JAKUB wrote:
>
>> I'm a new
ZBUDNIEWEK. JAKUB wrote:
> I'm a newbie, but was able to tune it to correctly reply to user inputs.
> 2. Why (on Windows) do I have to give inputs in quotes not to cause an
> error (for ll input the error is ' NameError: name 'll' is not defined')?
If you are running the script under Python 2 yo
': 'Austin', 'Utah': 'Salt Lake City', \
'Vermont': 'Montpelier', \
'Virginia': 'Richmond', 'Washington': 'Olympia', \
'West Virginia': 'Charleston
On Tue, Jun 2, 2015 at 3:43 AM, Peter Otten <__pete...@web.de> wrote:
> Stephanie Quiles wrote:
>
>> Good evening,
>>
>> As you may have noticed i am really struggling with functions and
>> dictionaries. I need to figure out why this program is allowing me to
>> continue entering incorrect data ins
Stephanie Quiles wrote:
> Good evening,
>
> As you may have noticed i am really struggling with functions and
> dictionaries. I need to figure out why this program is allowing me to
> continue entering incorrect data instead of telling me my answer is
> incorrect. also at the end it’s not tallyin
Good evening,
As you may have noticed i am really struggling with functions and dictionaries.
I need to figure out why this program is allowing me to continue entering
incorrect data instead of telling me my answer is incorrect. also at the end
it’s not tallying the incorrect/correct responses
13 matches
Mail list logo