Implement a function named root_sum which receive an integer and return the result of summing all the scare roots from 1 to the number passed in.
For example, if the argument is 4, then the function returns 6.15 because √4 + √3 + √2 + √1 = 6.15.
It doesn't need to print (√4 + √3 + √2 + √1 = 6.15), in fact the function shouldn't print anything, just return the final value, in this case 6.15.
You may assume that #include <cmath> has already been included and you have access to the sqrt() function, which takes a single double or any value that can be converted to a double and returns that value's square root as a double.
No error checking is necessary. Assume the user always passed in a value > 1.
In c++ program
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- Write a program in Python with a function biggestBuried(s), which the parameter s is a string, and the function returns the largest integer buried in the string. If there is no integer inside the string, then return 0. For example, biggestBuried('abcd51kkk3kk19ghi') would return 51, and biggestBuried('kkk32abce@@-33bb14zzz') would return 33, since the '-' character is treated like any other non digit. print(biggestBuried('abcd51kkk3kk19ghi')) answer should be 51 print(biggestBuried('kkk32abce@@-33bb14zzz')) answer should be 33 print(biggestBuried('this15isast22ring-55')) answer should be 55arrow_forwardThe following requirments that weren't mentioned for solving the following Python Code below: The provided code for alphabet, test_dups, test_miss, and histogram. Your implementation of the has_duplicates function. A loop that outputs duplicate information for each string in test_dups. Your implementation of the missing_letters function. A loop that outputs missing letters for each string in test_miss. Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alphabet that are not in the argument string. The letters in the returned string should be in alphabetical order. Your implementation should use a histogram from the histogram function. It should also use the global variable alphabet. It should use this global variable directly, not through an argument or a local copy. It should loop over the letters in alphabet to determine which are missing from the input parameter. The function missing_letters should…arrow_forwardPlease fix of couple things in the code below. A couple of things. The input value is the waist size; the pant size is what the program is going to determine. The name valid_input is too generic. The name of the function should reflect what it does; also, start the name of the function with an action verb. For example, read_waist_size We can simplify the reading with the form : Read waist size WHILE waist size is not in the right range DO Show error message Read waist size again Simpler. By the way, the error message should let the user know how not to make the same mistake again. Something like, “This is not a correct size. Enter a value between 26 and 42.” is more helpful. def valid_input():while True:SizeOfPants = int(input("What pants size you are looking for: "))if 26 <= SizeOfPants <= 42:breakelse:print("This is not a correct size. Try Again!!")return SizeOfPants def return_size(SizeOfPants):if 26 <= SizeOfPants < 28:return "XXS"elif 28 <= SizeOfPants…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education