下面可以输出浮点数3.0的程序语句有:
A: print(float('3.0'))
B: print(float(3))
C: print(float(' 3.0\n'))
D: print(float('\t 3.0\n'))
A: print(float('3.0'))
B: print(float(3))
C: print(float(' 3.0\n'))
D: print(float('\t 3.0\n'))
举一反三
- import mathn=input("Enter:")try : n = float(n) print(math.sqrt(n)) print("done")except Exception as abc: print("出错了") print(abc)print("End")运行以上程序,如果输入n为4,则结果为: A: 出错了could not convert string to float: '12a'End B: 出错了End C: 出错了math domain errorEnd D: 2.0doneEnd
- 以下程序的输出结果是 void fun(float *a,float *b) {float w; *a=*a+*a; w=*a; *a=*b; *b=w; } main() {float x=2.0,y=3.0; float *px=&x,*py=&y; fun(px,py); printf("%2.0f,%2.0f\n",x,y); }
- 代码print(6 + 3.0)输出的结果为:
- 以下程序执行时会有错误提示的是( )。知识点:数据类型 A: print(str(125.68)) B: print(float(15)) C: print(int('4.6')) D: print(2.6e3)
- 用户输入0-100之间的百分制成绩,将其转为五分制输出,下面正确的答案为: A: score = float(input()) degree = "EEEEEEDCBAA" score_five = degree[score / 10] print(score_five) B: score = float(input()) degree = "EEEEEEDCBAA" score_five = degree[score // 10] print(score_five) C: score = float(input()) degree = "EEEEEEDCBAA" score_five = degree[int(score // 10)] print(score_five) D: score = float(input()) degree = "EEEEEEDCBA" score_five = degree[int(score // 10)] print(score_five)