subject

# 35.3) Hot and Cold A scientist has been recording observations of the temperature for the past
while. On hot days, they write "H", and for cold days, they write "C". Instead
of using a list, they kept all of these observations in a single long string
(e. g., "HCH" would be a hot day, followed by a cold day, and then another hot
day).

Write a function `add_hot_cold` that consumes a string of observations and
returns the number of hot days minus the number of cold days. To accomplish
this, you should process each letter in turn and add 1 if it is hot, and -1 if
it is cold. For example, the string "HCH" would result in 1, while the string
"CHCC" would result in -2.

You cannot use the built-in `.count()` method or the `len()` function for this
problem.

Don't forget to unit test your function.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:50
You have written, as part of a school assignment, a research paper on the solar system. you want to share this paper on your school website. on which type of server will you upload it?
Answers: 1
question
Computers and Technology, 22.06.2019 20:30
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
How many nibbles can be stored in a 16-bit word?
Answers: 1
You know the right answer?
# 35.3) Hot and Cold A scientist has been recording observations of the temperature for the past
Questions
question
Mathematics, 18.12.2020 22:30
question
Mathematics, 18.12.2020 22:30
question
Computers and Technology, 18.12.2020 22:30
question
Mathematics, 18.12.2020 22:30
question
Mathematics, 18.12.2020 22:30
Questions on the website: 13722367