Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am stuck on numbers 9 & 10 Ive spent hours working on both and cannot come to the answer on my own. Please explain

image text in transcribedI am stuck on numbers 9 & 10
Ive spent hours working on both and cannot come to the answer on my own. Please explain how!!!!
For number nine it keeps telling me ch not defined
Please answer both much appreciated thanks!
Department of Computer Scien 2. (15 pts) Write a generalizable Python function based on NoSpaces( from the previous question, called NoChar, that takes in 2 parameters: a string and a character. It returns the string without any of the character in it. For example: NoChar ("I'd rather be a hammer than a nail", a") returns the string "I'd rther be hmmer thn nil" def scramble2Encrypt (plainText): evenChars charCount0 for ch in plainText: if charCount % 2 "" 0: evenCharsevenChars ch else: oddCharsoddChars ch charCount charCount1 10 cipherText oddChara + evenChars return cipherText 12 Listing 3.2 Scrambling a plaintext message 3. (10 pts) The following question refers to the scramble2Encrypt function that's described in Listing 3.2 (p. 95) in the textbook. Consider a string shello" and the statements scramble2Encrypt (s) a. What is the value of s after you run that statement? If you repeat the statement s = scramble 2 Encrypt ( s ) multiple times, does s ever become "hello" again? If yes, how many times? The best way to answer this question is to actually try it out in Python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions