Home > other >  How to get rid of "None" result (not in a function)
How to get rid of "None" result (not in a function)

Time:02-19

import time
print("Welcome to password manager.\n")
time.sleep(1.5)
x = input(print("Do you want to store a new account 『c』, login 『l』, or exit 『e』?: "))

CodePudding user response:

Remove print() inside the input() method. The input() method takes only a string:

import time
print("Welcome to password manager.\n")
time.sleep(1.5)
x = input("Do you want to store a new account 『c』, login 『l』, or exit 『e』?: ")

CodePudding user response:

Here is the solution:

import time
print("Welcome to password manager.\n")
time.sleep(1.5)
x = input("Do you want to store a new account 『c』, login 『l』, or exit 『e』?: ")
print(x)

CodePudding user response:

The print function returns nothing or a None

x = print("Hello python")
print(x)   # None

The input function prompts the value from a user and prints the statement at the same time. Look here. Therefore, you can remove the nested print. and print the return of the input function.

  • Related