# .';:cc;. # .,',;lol::c. # ;';lddddlclo # lcloxxoddodxdool:,. # cxdddxdodxdkOkkkkkkkd:. # .ldxkkOOOOkkOO000Okkxkkkkx:. # .lddxkkOkOOO0OOO0000Okxxxxkkkk: # 'ooddkkkxxkO0000KK00Okxdoodxkkkko # .ooodxkkxxxOO000kkkO0KOxolooxkkxxkl # lolodxkkxxkOx,. .lkdolodkkxxxO. # doloodxkkkOk .... .,cxO; # ddoodddxkkkk: ,oxxxkOdc'..o' # :kdddxxxxd, ,lolccldxxxkkOOOkkkko, # lOkxkkk; :xkkkkkkkkOOO000OOkkOOk. # ;00Ok' 'O000OO0000000000OOOO0Od. # .l0l.;OOO000000OOOOOO000000x, # .'OKKKK00000000000000kc. # .:ox0KKKKKKK0kdc,. # ... # # Author: peppe8o # Date: Oct 13th, 2023 # Version: 1.0 # blog: https://peppe8o.com from utime import ticks_us, sleep, ticks_diff a = 0.9 start = ticks_us() print("The variable is equal to " + str(a)) delta = ticks_diff(ticks_us(), start) - 50 print('Elapsed time with the str() method: %d us'%(delta)) start = ticks_us() print("The variable is equal to", a) delta = ticks_diff(ticks_us(), start) - 50 print('Elapsed time with the commas concatenation: %d us'%(delta)) start = ticks_us() print("The variable is equal to %0.2f" %a) delta = ticks_diff(ticks_us(), start) - 50 print('Elapsed time with modulo operator: %d us'%(delta)) start = ticks_us() print("The variable is equal to: {:0.2f}".format(a)) delta = ticks_diff(ticks_us(), start) - 50 print('Elapsed time with formath() method: %d us'%(delta)) start = ticks_us() print(f"The variable is equal to: {a:0.2f}") delta = ticks_diff(ticks_us(), start) - 50 print('Elapsed time with f-strings: %d us'%(delta))