Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!