|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
a = input('请输入一个整数(输入Q结束程序): 'end='')
while a != 'Q':
temp = int(a)
print('十进制 -> 十六进制:','{0} -> {1:#x}'.format(temp,temp))
print('十进制 -> 八进制:','{0} -> {1:#o}'.format(temp,temp))
print('十进制 -> 二进制:','{0} -> '.format(temp),bin(temp))
break
点击运行就报错,invalid syntax
显示错误位置为第三句
- a = input('请输入一个整数(输入Q结束程序): ')
- while a != 'Q':
- temp = int(a)
- print('十进制 -> 十六进制:','{0} -> {1:#x}'.format(temp,temp))
- print('十进制 -> 八进制:','{0} -> {1:#o}'.format(temp,temp))
- print('十进制 -> 二进制:','{0} -> '.format(temp),bin(temp))
- break
复制代码
input没有end参数
break应该缩进
|
|