Pycharm IDE

dn PythonList at DancesWithMice.info
Wed Apr 19 03:17:03 EDT 2023


Kevin,

As mentioned in another response, the format of these messages seems 
very confused.

Please copy-paste all of (the pertinent part of) the code, and ensure 
that the line-endings are in the correct places, tab/indentation looks 
correct, etc?
(this will allow us to copy the same code into our PyCharm software and 
see what is happening!)

There still appears to be both an apostrophe (') and quotation-marks 
("). Do you want the user to see one/both?

There was mention of this being an input prompt - hence the 
question-mark. Are you aware that this could be done as part of the 
input() function?

How about creating a string and then printing that, eg

prompt = f'"I am thinking of a number between 1 to {LIMIT}"
print( prompt )

NB because of the question asked earlier, the above code is NOT 
syntactically-correct Python!
NBB am assuming there's previous code which defines LIMIT



On 19/04/2023 17.27, Kevin M. Wilson via Python-list wrote:
> Ok, I got rid of the "print (f'"I am thinking of a number between 1 to {LIMIT}\n")"print ("I am thinking of a number between 1 to {LIMIT}\n"),
> and Pycharm stopped complaining about it... WHY??
> Perplexed
> "When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."
> Isaiah 43:2
> 
>      On Tuesday, April 18, 2023 at 11:17:52 PM MDT, Kevin M. Wilson via Python-list <python-list at python.org> wrote:
>   
>   print (f'"I am thinking of a number between 1 to {LIMIT}\n")I had the impression that the format specifier 'f' was necessary for the print function, but the double quotes are for the string printed to the user, as a prompt!The Pycharm IDE is showing that it expects a single quotation mark or ')'! No error message is displayed.
> Perplexed
> "When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."
> Isaiah 43:2
> 
>      On Tuesday, April 18, 2023 at 06:44:37 PM MDT, aapost <aapost at idontexist.club> wrote:
>   
>   On 4/18/23 19:18, Kevin M. Wilson wrote:
>> Why complain about a 'comma', or a ')'???
>>        print (f'"I am thinking of a number between 1 to {LIMIT}\n")
> 
> my version says it expects ' first (to close the fstring)
> then on a new line below it, it mentions the comma and )
> I believe that is just showing you after ' it expects you to end the
> print with ) as you have
> or , to add additional arguments to print

-- 
Regards,
=dn


More information about the Python-list mailing list