Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1/ A function called sumSeries () that prompts the user for a non-negative integer n. If the user enters a negative number, continue to prompt

Q1/

A function called sumSeries () that prompts the user for a non-negative integer n.

If the user enters a negative number, continue to prompt until a positive integer is obtained.

The function should return as result the sum of the following series:

1000+ 1/12 +1/22 +1/32 +1/42 + ... + 1 / n2 for a given integer n.

For example :

for n = 0, the function must return 1000.0

for n = 1, the function must return 1001.0

for n = 2, the function must return 1001.25

for n = 3, the function must return 1001: 3611111111111 etc.

Q2/

In this question, you are not allowed to use Python's predefined methods to

strings (that is, the string functions that you call with the operator.

point).

A character is said to be extraordinary if it is one of the following values:

Lower case letters between e and j (inclusive), upper case letters between F and X (inclusive),

digits between 2 and 6 (inclusive), exclamation point (!), comma (,), and backslash (\).

You must count how many times these characters appear in a string.

A function called accountMembers (s) which takes a single input parameter s, of type

str. memberCount then returns the number of characters in s, which are extraordinary.

So, if there are two Xs in s, MemberCount must have two extraordinary characters (one

for each occurrence of X in s).

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions