Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write function alterStringis) that takes as input a string s and returns a new string such that each vowel (aeiou) occurrence in the original
1. Write function alterStringis) that takes as input a string s and returns a new string such that each vowel (aeiou) occurrence in the original has been replaced by 5 consecutive copies of that vowel with the same case as in the original), and an 'S has been added to the end of the result. or example, 2. Write function reverselntin) that takes a positive integer, n, as input and returns the integer whose digits are the reverse of those in n. Assure that the input does not end in 0. For example reverselnt 12405) would return 50421 IMPORTANT NOTES: Use some of what you practiced in the Jan. 29/30 discussion section. You may not use any string operations. Yes, it would be easy using string operations but your job here is to do it with simple math operations. 3. Write function, srriallestCharacterLargerThanfkeyChar, inputstring that takes as input key character, keyChar, and a string of one or more letters (and no other characters) and prints 1) the 'smallest character in the string that is larger than ke Char, where one character is smaller than another if it occurs earlier in the alphabet thus1s smaller than y and both are larger than B and 2 the index of the fina occurrence of that character when comparing letters in this problem ignore case. Le. 'e' and 'E' should be treated as equal. However, your output should use the case of the smallest letter as it appears at the index of its final accurrence in the string. Thus, in the example below The smallest character is y'.. would be incorrect If no character in the given string is larger than keyChar, print an appropriate message. Important:your function must contain exactly one loop and you must determine the index of the character within the loop (is you may not use Python's max, min, index, reverse, -1d, nd you may not use any lists). You may, however, use Python's lower furcton to help with string case if you wish should yield something like .snr.CeB-u-S-3'Jr-la aul-ed usulu.: leu..: lau,'s' iz 'Y ual :i.iuu 16. uueusz u. 4. Pi is an irrational number whose first digits are: 3.1415928. The precise value of p is equa to the infinite sum: pi 4/1 - 4/3 4/5 - 4/7 + 4/9 -41You ca compute better and better approximations of pi by computing more terms of the series. Write function approxPideltavalue) that computes and returns an approximation of pi. Use a while loop (not a for loop). Each iteration should updtethe pi approximation by including one acdditional term from the series. The loop should terminate when the difference between the previous iteration's approximation and the new iteration's approximation is less than deltaValue. For examplo 1. Write function alterStringis) that takes as input a string s and returns a new string such that each vowel (aeiou) occurrence in the original has been replaced by 5 consecutive copies of that vowel with the same case as in the original), and an 'S has been added to the end of the result. or example, 2. Write function reverselntin) that takes a positive integer, n, as input and returns the integer whose digits are the reverse of those in n. Assure that the input does not end in 0. For example reverselnt 12405) would return 50421 IMPORTANT NOTES: Use some of what you practiced in the Jan. 29/30 discussion section. You may not use any string operations. Yes, it would be easy using string operations but your job here is to do it with simple math operations. 3. Write function, srriallestCharacterLargerThanfkeyChar, inputstring that takes as input key character, keyChar, and a string of one or more letters (and no other characters) and prints 1) the 'smallest character in the string that is larger than ke Char, where one character is smaller than another if it occurs earlier in the alphabet thus1s smaller than y and both are larger than B and 2 the index of the fina occurrence of that character when comparing letters in this problem ignore case. Le. 'e' and 'E' should be treated as equal. However, your output should use the case of the smallest letter as it appears at the index of its final accurrence in the string. Thus, in the example below The smallest character is y'.. would be incorrect If no character in the given string is larger than keyChar, print an appropriate message. Important:your function must contain exactly one loop and you must determine the index of the character within the loop (is you may not use Python's max, min, index, reverse, -1d, nd you may not use any lists). You may, however, use Python's lower furcton to help with string case if you wish should yield something like .snr.CeB-u-S-3'Jr-la aul-ed usulu.: leu..: lau,'s' iz 'Y ual :i.iuu 16. uueusz u. 4. Pi is an irrational number whose first digits are: 3.1415928. The precise value of p is equa to the infinite sum: pi 4/1 - 4/3 4/5 - 4/7 + 4/9 -41You ca compute better and better approximations of pi by computing more terms of the series. Write function approxPideltavalue) that computes and returns an approximation of pi. Use a while loop (not a for loop). Each iteration should updtethe pi approximation by including one acdditional term from the series. The loop should terminate when the difference between the previous iteration's approximation and the new iteration's approximation is less than deltaValue. For examplo
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started