First start the software, because of the mac environment, use Command+N (windows: Ctrl+N) to create a new text-based interactive window, and then Command+S (windows: Ctrl+S) to save the location
Then start editing the code Fn+F5 can start calculation after running
is_continue='y'
while is_continue=='Y' or is_continue=='y':
def shi(n):
b = " "
while n != 0:
b = str(n % 2)+b
n //= 2
return b
n = int(input("请输入一个十进制数:"))
b = shi(n)
print("%d的二进制数:%s" % (n, b))
is_continue=input('\n想再试一次吗?(Y/N)')
After Fn+F5 is running, you can start calculating
The above is my sharing of base conversion, I hope you like it.