Как получить значение if input("xyz") где-то кроме оператора if?Python

Программы на Python
Гость
Как получить значение if input("xyz") где-то кроме оператора if?

Сообщение Гость »


Мне интересно, можно ли получить значение из оператора if без добавления дополнительных строк кода
ex:

Код: Выделить всё

if input('Seed Generation | N to generate a new seed\n') not in ['N','n','',' ']:
random.seed(userInput) #I want what the user inputed to be here
If the user were to input "123" I would want the value of userInput to be 123. The only major reason I want to do this is to learn how to condense my code and make it easier to read.


Источник: https://stackoverflow.com/questions/781 ... -statement

Вернуться в «Python»