Input method issue

29 views
Skip to first unread message

Thomas Balstrøm

unread,
Apr 30, 2024, 7:36:18 AMApr 30
to PyScripter
In PyScripter ver. 4.3.4.0 x64 having set up a dictionary with some persons' names as keys and their corresponding age as a value, I try to set up a loop asking the user to type a name using Pyhon's input function,  look up the person's matching age in the dictionary and print it. If typing a -1 for the name, the while loop shall break. 
The script is here:

ages = {"Ann": 24, "Liz": 19, "Tim": 18, "Tom": 24}

name = "Tom"  #just to set up a meaningful while condition
while name in ages.keys():
    name = input('Enter name (to quit type -1):')
    if name == "-1": break
    print(name,"is:", ages[name], "years old.")

When executing the script, a popup asks for a name, but when typed and hitting -Enter- nothing is printed to the Interpreter Window. First, when re-enetering a 2nd name, the previous result is printed together with the new one. If you continue entering a 3rd name, nothing is printed in the Interpreter Window, but when entering a fourth name, the 3rd and 4th result is printed. 

Can anyuone please explain what is going on? And how to circumvent this behavior?

Thanks, Thomas Balstroem, Univ. of Copenhagen, Denmark

PyScripter

unread,
Apr 30, 2024, 7:45:27 AMApr 30
to PyScripter
This was a bug that has been fixed.  The fix will be available with the next release of PyScripter.  In the mean time you can download an updated executable with the fix from this link.  Then just replace PyScripter.exe with the one in the zip file.

thomasb...@gmail.com

unread,
Apr 30, 2024, 10:55:50 AMApr 30
to pyscr...@googlegroups.com

Appreciate it. Thank you.

Best regards, Thomas

--
You received this message because you are subscribed to the Google Groups "PyScripter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyscripter+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyscripter/9500fd35-7af8-4a62-b53c-2c9d406e2610n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages