Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python question 4. Function Two: sumOrd Specification: The second function you will write should be called 'sumOrd'. Your function should take one (1) argument, a

python question

image text in transcribed

4. Function Two: sumOrd Specification: The second function you will write should be called 'sumOrd'. Your function should take one (1) argument, a list containing characters or the integer-1. For example: [ 'a, , 'b, , 'c' , -1, 'd, , 'e' , -1] would be a valid input argument. You may assume all input will be valid. The function should return one (1) integer calculated as follows. The return value should be the sum of all the return values of the ord function evaluated on each character until a -1 is encountered. You may not use any built-in functions other than ord). Additionally, you must use an indefinite loop (a while loop). There may be NO return statement in the body of the loop (i.e., the return statement must come outside the while loop). For example, if a', 'b', 'c, i d', 'e' 1 is the input, then the return value should be calculated as: ord('a) +ord ('b) To get credit you must use a single while loop. Testing Create your own test cases iat et-1 + ord('c

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

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions