Computers and Technology

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. Call your function on the string "CCCHCHHHCHCHC" and print the result.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 16:00, ginaaa20
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
image
Computers and Technology, 23.06.2019 17:00, kyleemarie2003
Companies that implement and apply an information system effectively can create
Answers: 1
image
Computers and Technology, 23.06.2019 21:20, nicki76
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
image
Computers and Technology, 24.06.2019 15:30, jhony70
What type of forensic evidence was recovered during the bomb set off at the new mexico facility on the video that was similar to the evidence obtained at the boston bombings and how did the evidence allow the researchers to connect other pieces of evidence to the same bomb?
Answers: 2
Do you know the correct answer?
A scientist has been recording observations of the temperature for the past while. On hot days, they...

Questions in other subjects:

Konu
Chemistry, 08.04.2021 17:20
Konu
Mathematics, 08.04.2021 17:20