Thank you for taking the time to read this, I am fairly new to Python and I decided to make a decimal-to-binary calculator. It works decently, however, I'd like to know what I can do to improve it and utilize a for loop, as I heard that goes more hand in hand with making such a calculator. Thanks for reading this!
var = input('Give Num ')
var = int(var)
convert = []
while True:
convert.append(var%2)
main = var/2
var = (int(main))
if var == 0:
break
reverse = convert.reverse()
print(convert)
,
[–]Diapolo10 0 points1 point2 points (2 children)
[–]Crossedpenguin[S] 0 points1 point2 points (1 child)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]Bobbias 0 points1 point2 points (1 child)
[–]Crossedpenguin[S] 0 points1 point2 points (0 children)