input

How do I make this user input change the calculation in this if statement?

How do I make this user input change the calculation in this if statement? Question: How do I make this user input change the calculation in this if statement? print("I have information for the following planets:n") print(" 1. Venus 2. Mars 3. Jupiter") print(" 4. Saturn 5. Uranus 6. Neptunen") weight = 185 planet = …

Total answers: 1

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

Python input correcct type and input but gives error with or without correct input Question: 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 pappern") choicesChecker(userInput) I am making a …

Total answers: 1

Listening for user inputs to to manipulate functions already running

Listening for user inputs to to manipulate functions already running Question: I have 2 files, main.py and app.py main.py import _thread import time def launch(thread_name): h = Hello() h.say_hello() def input_reader(thread_name): global should_say_bye should_say_bye = False x = input() if x.lower() == "q": # Should run the say_bye() function from the Hello class. But using …

Total answers: 2

Is it possible to use one input to have to put multiple integers into a list

Is it possible to use one input to put multiple integers into a list? Question: marks = input("Please enter marks ") for i in range(1,21): marksList = [] marksList.append(marks) print(marksList) This is my code. I want to use the same variable and enter 20 marks using the same input, and then append it to the …

Total answers: 3

Fixing Input UnboundLocalError

Fixing Input UnboundLocalError Question: In my code I’m trying to code a password login loop that will keep requiring a password input until a correct password (defined in an .env file) is given. However, when I run the code below I get an "UnboundLocalError cannot access local variable ‘input’ where it is not associated with …

Total answers: 1

Python, let user define list variable

Python, let user define list variable Question: Trying to enable a user to input a mixed list in the correct format, ie with square brackets and commas already separating values. Using the input() function saves the entire input as a string. Using list() around this, just makes every character of the string a separate part …

Total answers: 1

User Input Slice String

User Input Slice String Question: stringinput = (str(input("Enter a word to start: "))) removeinput = (str(input("How many character’s do you want to remove?"))) if (str)(removeinput) > (str)(stringinput): print("Cannot remove more chars than there are chars, try again") else: removed = stringinput[-1,-removeinput,1] print((str)(removed)) Traceback (most recent call last): File "C:UsersxPycharmProjectspythonProjectPynative Beginner Tasks.py", line 110, in <module> …

Total answers: 1