Using F-Strings to Format and Display Product Information in Python

Assign two variables that store the following values:

  1. $ 34.99 - product price (float) 20 lbs
  2. product weight (int)

Using the f-string formatting style print to the console the following message:

Price: $34.99. Weight: 20 lbs.

Output: Price: $34.99. Weight: 20 lbs.

Solutions

Solution: 1

price = 34.99
weight = 20

print(f'Price: ${price}. Weight: {weight} lbs.')