摘要: 1 from math import sqrt 2 n = float(input('输入一个数:')) 3 ans1 = sqrt(n) 4 ans2 = n**0.5 5 print('%.2f的平方根是: %.2f' %(n, ans1)) 6 print('{:.2f}的平方根是: {:.2 阅读全文
posted @ 2022-03-27 20:14 张博睿 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 1 print(chr(0x1f600), end = " ") 2 print(chr(0x1f601), end = " ") 3 print(chr(0x1f602), end = " ") 4 print(chr(0x1f603), end = " ") 5 print(chr(0x1f60 阅读全文
posted @ 2022-03-27 20:11 张博睿 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 ans1 = 0.1 + 0.2 2 print(f'0.1 + 0.2 = {ans1}') 3 from decimal import Decimal 4 ans2 = Decimal('0.1') + Decimal('0.2') 5 print(f'0.1 + 0.2 = {ans2}' 阅读全文
posted @ 2022-03-27 20:08 张博睿 阅读(7) 评论(0) 推荐(0) 编辑
摘要: r1 = eval('1 + 2') print(type(r1), r1) r2 = eval('[1, 6, 7.5]') print(type(r2), r2) r3 = eval('"python"') print(type(r3), r3) r4 = eval('7, 42') print 阅读全文
posted @ 2022-03-23 17:23 张博睿 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 print('hey, u') 2 3 4 print('hey','u') 5 x,y,z=1,2,3 6 print(x, y, z) 7 8 9 print('x=%d, y=%d, z=%d'%(x,y,z)) 10 print('x = {}, y = {}, z = {}'.form 阅读全文
posted @ 2022-03-23 17:15 张博睿 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-03-23 16:22 张博睿 阅读(12) 评论(0) 推荐(0) 编辑