Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. city = "Seoul"
  2. high_temperature = 18
  3. low_temperature = 9
  4. temperature_unit = "degrees Celsius"
  5. weather_conditions = "light rain"
  6.  
  7. #todo rewrite this line to use the format method rather than string concatenation
  8. alert = "Today's forecast for " + city + ": The temperature will range from " + str(low_temperature) + " to " + str(high_temperature) + " " + temperature_unit + ". Conditions will be " + weather_conditions + "."
  9.  
  10. # print the alert
  11. print(alert)
  12.  
  13. formatted_alert = "Today's forecast for {}: The temperature will range from {} to {} {}. Conditions will be {}.".format(city, str(low_temperature), str(high_temperature), temperature_unit, weather_conditions)
  14.  
  15. print(formatted_alert)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement