-1

this error is shown :

Exception has occurred: TypeError
int() argument must be a string, a bytes-like object or a number, not 'NoneType'
File "C:\Users\Asus\Desktop\pro6.py", line 3, in <module>
print(int(a))

My code:

x=int(input())
a=print((str(x%5)+str(x%100//10)+str(x//100)))
print(int(a)*2)
CDJB
  • 14,043
  • 5
  • 29
  • 55
iman j
  • 21
  • 4
  • The [`print`](https://docs.python.org/3/library/functions.html#print) function returns `None`. What are you trying to do? Why can't you just do `a = (x % 5) * 100 + (x % 100 // 10) * 10 + x // 10`? – Some programmer dude Aug 15 '19 at 10:00
  • `print` returns none. – Sayse Aug 15 '19 at 10:00
  • @Someprogrammerdude i wanna reverse 3-digit number and multiply by 2 .this code can reverse the number but cannot multiply it by two. – iman j Aug 15 '19 at 10:07

1 Answers1

0

Remove "print" in the second statement:

x=int(input())
a=(str(x%5)+str(x%100//10)+str(x//100))
print(int(a)*2)

You shouldn't be assigning "print" to a variable.

Brozo
  • 277
  • 1
  • 9
  • No problem, also as Some Programmer Dude has mentioned you dont really need to convert from int to str in a variable. You take int's and you return int's, unless converting to str for whatever reason is a must. Dont forget to vote, I do need those rep points :) – Brozo Aug 15 '19 at 10:22