Trying to code a function with one numeric input. If the number <= 0, return -1. If the number > 0, divide that integer over-and-over by 2

前端 未结 0 690
鱼传尺愫
鱼传尺愫 2020-11-21 20:16

I am new to Python and coding. This is what I have so far, but can\'t get it to work.

def halve_to_2( num ): while True: num = num /2 if num < 2: else: if num <

相关标签:
回答
  • 消灭零回复
提交回复
热议问题