Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Homework 2222.7

 

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 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY