[Tutor] Formatting Prompts

John Weller john at johnweller.co.uk
Tue Jul 14 05:07:20 EDT 2020


Hi Mike

> The input() function allows for a prompt to be inserted to provide information to the
> user. Can this string be formatted or does it just accept ascii text? I'm shooting for
> something like:
> 
> Counter += 1
> 
> Input("This is attempt# ", counter)
> 

Your code looks as though you are trying to output a string "This is attempt #47" or whatever whereas your input command is asking the user for an attempt number - at least that is what it looks like to me, no doubt Alan will correct me if I am wrong 😊

If it is the case then your command should be print("This is attempt #" + str(counter)) I think.

John
> 
> 
> I've tried several variations and nothing seems to work.
> 



More information about the Tutor mailing list