1. (Function and parameters) Write a function called calculate_different_values that uses three parameters: param1, param2, and param3. You can do anything with these three parameters, as long as each are being used in some way. The result should be returned at the end of the function.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.2: Returning A Single Value
Problem 3E
icon
Related questions
Question
PLEASE help me with these practice problems
1. (Function and parameters) Write a function called calculate_different_values that uses three parameters:
param1, param2, and param3. You can do anything with these three parameters, as long as each are being used
in some way. The result should be returned at the end of the function.
2. (Conditionals) Write a function called classify_letter that will ask a user to input a letter, and will then print
whether the letter is a vowel or a consonant. If the user puts in something unexpected (something that is not a
letter, or is longer than one character), a helpful error message should print.
3. (Lists, Conditionals) Write a function called filter_list that takes in a list as a parameter. This function should
loop over the list, adding all values that are greater than 10 and less than 90 to a new list. The function should
return the new list that was created.
Example Input: [4, 28, 99, 53, 10, 87, 101]
Expected Output: [28, 53, 87]
4. (While Loops, Modulo) Create a while loop that will loop over all values from 0 to 50, storing the values that are
O mod 5 in a list. Once done, the list should be printed.
Expected Output: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
5. (While Loops) The following code loops over a string and prints out each character using a for loop. Rewrite it
using a while loop. It should have the same functionality as it did in the for loop version.
name = "Comp1010"
for ch in name:
print(ch)
Transcribed Image Text:PLEASE help me with these practice problems 1. (Function and parameters) Write a function called calculate_different_values that uses three parameters: param1, param2, and param3. You can do anything with these three parameters, as long as each are being used in some way. The result should be returned at the end of the function. 2. (Conditionals) Write a function called classify_letter that will ask a user to input a letter, and will then print whether the letter is a vowel or a consonant. If the user puts in something unexpected (something that is not a letter, or is longer than one character), a helpful error message should print. 3. (Lists, Conditionals) Write a function called filter_list that takes in a list as a parameter. This function should loop over the list, adding all values that are greater than 10 and less than 90 to a new list. The function should return the new list that was created. Example Input: [4, 28, 99, 53, 10, 87, 101] Expected Output: [28, 53, 87] 4. (While Loops, Modulo) Create a while loop that will loop over all values from 0 to 50, storing the values that are O mod 5 in a list. Once done, the list should be printed. Expected Output: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50] 5. (While Loops) The following code loops over a string and prints out each character using a for loop. Rewrite it using a while loop. It should have the same functionality as it did in the for loop version. name = "Comp1010" for ch in name: print(ch)
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning