Python - Foundation

https://docs.python.org/3/library/index.html -1. print format and f string, use print() eg: x='seven' print('x is {}'.format(x)) print ('x is {} {}'.format (8,10)) print ('x is {1:<09} {0:>09}'.format (8,10)) a=8 b=10 x= f'seven {b} {a}' print (x) -2. decimal eg: from decimal import * a = Decimal('.10') b = Decimal('.30') x = a+a+a-b print (x) -->0.00 if no decimal, x is almost 0 but not 0 due to accuracy and precision -3.

Continue reading

Author's picture

Stella Wang

桃李春风一杯酒,江湖夜雨十年灯

SOHO

China