subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
You know the right answer?
A scientist has been recording observations of the temperature for the past while. On hot days, they...
Questions
question
Mathematics, 17.02.2021 14:10
question
English, 17.02.2021 14:10
question
Mathematics, 17.02.2021 14:10
question
Mathematics, 17.02.2021 14:10
question
Mathematics, 17.02.2021 14:10
question
English, 17.02.2021 14:10
Questions on the website: 13722367