# # demonstrate using the f"..." form for string # # Matt Bishop, MHI 289I, Fall 2025 # x = 1.2345678987654321 y = "A weird number" # print these in various ways print("Using nothing:", y, "x is", x) print("Using %% notation: %s is %.7f" % (y, x)) print("Using format: {0} x is {1:.7f}".format(y, x)) print(f"Using an f string: {y} x is {x:.7f}") print(f"To 10 places: {y} x is {x:.10f}") print(f"And use a field width 20: {y} x is {x:20.10f}")