better writing style for the following code

后端 未结 5 638
借酒劲吻你
借酒劲吻你 2021-01-28 09:42

I was wondering if someone could tell me the pythonic way to check out the following.

I have a 6 bit binary number and want to check with its decimal values. Using mathe

5条回答
  •  一向
    一向 (楼主)
    2021-01-28 10:06

    To add to the responses of the others, you should read about the recommended Python style in PEP 8.

    With your if version, the brackets are undesirable and spacing is desirable:

    if a == 1:
        pass
    elif a == 2:
        pass
    elif a == 3:
        pass
    else:
        pass
    

提交回复
热议问题