# =================================================================== # # =================================================================== b1 = True # boolean d1 = { 'x':10, 'y':20, 'z':30} # dictionary f1 = 456.789 # float i1 = 123 # integer l1 = ['a','b','c'] # list s1 = 'abc' # string t1 = ('abc',l1,123) # tuple print('--- use data types -----------------------------') try: print('start ' + s1 + ' end') except Exception as e: print(e) try: print('start ' + i1 + ' end') except Exception as e: print(e) try: print('start ' + f1 + ' end') except Exception as e: print(e) try: print('start ' + l1 + ' end') except Exception as e: print(e) try: print('start ' + t1 + ' end') except Exception as e: print(e) try: print('start ' + d1 + ' end') except Exception as e: print(e) try: print('start ' + b1 + ' end') except Exception as e: print(e) print('--- use str function ---------------------------') print('start ' + str(i1) + ' end') print('start ' + str(f1) + ' end') print('start ' + str(l1) + ' end') print('start ' + str(t1) + ' end') print('start ' + str(d1) + ' end') print('start ' + str(b1) + ' end') print('--- use string format method -------------------') print('start {} end'.format(s1)) print('start {} end'.format(i1)) print('start {} end'.format(f1)) print('start {} end'.format(l1)) print('start {} end'.format(t1)) print('start {} end'.format(d1)) print('start {} end'.format(b1))