You start with num = 0
. You then set temp = num
, so temp
is zero. Thus your while temp > 0
loop never runs, and so nothing is ever added to rev
. So when you try to use join
, it just joins an empty list and produces an empty string.
How to fix this is unclear, since you don't say what you want the code to do.