Guest User

Untitled

a guest
Feb 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 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. alert = "Today's forecast for {}: The temperature will range from {} to {} {}.\nConditions will be {}.".format(city, str(low_temperature), str(high_temperature), temperature_unit, weather_conditions)
  11.  
  12. # print the alert
  13. print(alert)
Add Comment
Please, Sign In to add comment