I am working on a little program and I want to use:
ans = int(input(print(multi,\'x\',num,\'=\')))
This works well except for the fact that
input takes a prompt
string as its argument, which it will print automatically, but print
returns None
; it is this that gets printed by input
. Your code is equivalent to:
prompt = print(...) # prompt == None
ans = int(input(prompt))
Instead, use str.format to build the prompt and pass it straight to input
:
ans = int(input('{0}x{1}='.format(multi, num)))