Computers and Technology

# 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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, fnaflover8505
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
image
Computers and Technology, 22.06.2019 11:00, loveworld3798
When working with a team you should always do the following, except? question 3 options: be dependable and trustworthy be sensitive to others feelings do your fair share critique members of the group
Answers: 2
image
Computers and Technology, 22.06.2019 15:00, mitchellk872
Which of the following statements tests if students have a grade of 70 or above, as well as fewer than five absences? a: if(grade > = 70 and daysabsent < = 5): b: if(grade > = 70 or daysabsent < = 5): c: if(grade > 70 and daysabsent < = 5): d: if(grade > 70 or daysabsent < = 5): i took the test the answer is a
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, jackie0833
Which option allows you to view slides on the full computer screen?
Answers: 1
Do you know the correct answer?
# 35.3) Hot and Cold A scientist has been recording observations of the temperature for the past

Questions in other subjects:

Konu
Chemistry, 21.10.2020 16:01
Konu
Mathematics, 21.10.2020 16:01