>>> print(type(633))>>> print(type("633")) >>> print(type(633.0))
mon_sales = 121 tues_sales = 105 wed_sales = 110 thurs_sales = 98 fri_sales = 95 total = str(mon_sales + tues_sales + wed_sales + thurs_sales + fri_sales) print("This week\'s total sales: " + total)
python string method
https://docs.python.org/3/library/stdtypes.html#string-methods
prophecy = "And there shall in that time be rumours of things going astray, and there will be a great confusion as to where things really are, and nobody will really know where lieth those little things with the sort of raffia work base, that has an attachment…at this time, a friend shall lose his friends’s hammer and the young shall not know where lieth the things possessed by their fathers that their fathers put there only just the night before around eight o’clock…" vowel_count = 0 vowel_count += prophecy.count('a') vowel_count += prophecy.count('A') vowel_count += prophecy.count('e') vowel_count += prophecy.count('E') vowel_count += prophecy.count('i') vowel_count += prophecy.count('I') vowel_count += prophecy.count('o') vowel_count += prophecy.count('O') vowel_count += prophecy.count('u') vowel_count += prophecy.count('U') print(vowel_count)
format
log_message = "IP address {} accessed {} at {}".format(user_ip, url, now) city = "Seoul" high_temperature = 18 low_temperature = 9 temperature_unit = "degrees Celsius" weather_conditions = "light rain" alert = "Today's forecast for {}: The temperature will range from {} to {}{}. Conditions will be {}.".format(city, high_temperature, low_temperature, temperature_unit, weather_conditions) # print the alert print(alert)