How could I update an input field live?

I’m trying to update an input field in real-time. I don’t know how else to put it. I’m making a sort-of shell in Python 3.11, and I have the current working directory as the input field. This is what I have right now: cwd0=os.getcwd() while True: command_line=input(f"{cwd0}! ") After changing directories with os.chdir, the input… Read More How could I update an input field live?

How to remove an item from a list with enumeration starting at one?

if main == ‘remove’: for count, item in enumerate(grocery_list, 1): print(f'{count}. {item}’) which_item = input(‘Which item do you want to remove? Type in the name of the item please! ‘) del grocery_list[int(which_item-1)] print(‘Your item has been removed! ‘) continue I’m trying to let user remove an item by typing in the enumerated index. When they… Read More How to remove an item from a list with enumeration starting at one?

Python input correcct type and input but gives error with or without correct input

def choicesChecker(userchoice): if userchoice != ‘r’ or ‘p’ or ‘s’: print(‘error’) print(type(userInput)) else: print(‘correct input’) userInput = input("Pls input one of the following \n r for rock, \n s for siccors \n p for papper\n") choicesChecker(userInput) I am making a basic python rock paper scissors game and when i type r or p or s… Read More Python input correcct type and input but gives error with or without correct input

Is it possible to endlessly add key:value pairs to a dictionary based upon user input?

I have a dictionary called "user_database" that holds users, and a variable called "registered_users" that increments as the input is called in a "while True" loop. How can I endlessly add new users to the dictionary as the inputs are entered? this is what I have, (BTW I am a beginner at python) user_database =… Read More Is it possible to endlessly add key:value pairs to a dictionary based upon user input?

How do I solve this exercise without creating redundant elements in my dictionary with Python?

I am preparing for an exam of basic python programming, and this is one of the exercises in preparation for it: Countries and cities are listed in file "countries.txt". On each line, there is the name of a country and some cities of the country. For example, USA Boston Pittsburgh Washington Seattle UK London Edinburgh… Read More How do I solve this exercise without creating redundant elements in my dictionary with Python?

How to listen to input from two pointing devices (mouse and drawing tablet) simultaneously on the same page?

I would like to listen to events from two different input devices, a mouse and a drawing tablet without them interfering: different events when the mouse is moved or clicked and different events then the stylus is moved or pressed. Is that possible or does it have to with how the OS receives data from… Read More How to listen to input from two pointing devices (mouse and drawing tablet) simultaneously on the same page?