![](/img/trans.png)
[英]Write a program that asks a user to enter two integer numbers and check if either one is another one’s multiple
[英]program which asks for two numbers: One decimal (floating point) and one integer (whole number), first number (float) to the power of the second (int)
给出一个十进制数:5.5
给一个 integer 编号:3
5.5 的 3 次方约为 166。
准确地说是166.38。
dec = float(input('Give a decimal number: '))
ger = input('Give an integer number: ')
z = dec**ger
print(dec,'to the power of',int,'is approximately',{0:.2f}.format(z))
print('To be exact it is',str(z)+".")
文件“ tester .python3”,第 10 行
print(dec,'的幂',int,'大约是',{0:.2f}.format(z))
SyntaxError:无效的语法
格式规范需要是一个字符串,因此在引号内:
print(dec,'to the power of',int,'is approximately',"{0:.2f}".format(z))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.