Question

PYTHON! If From = 1235, To = 7124, take Sum_A = SumOfSqrOfInts_A(From,To) Sum_B = SumOfSqrOfInts_B(From,To) Find...

PYTHON! If From = 1235, To = 7124, take Sum_A = SumOfSqrOfInts_A(From,To) Sum_B = SumOfSqrOfInts_B(From,To) Find Sum_A/ Sum_B, then print out the answer out to five decimal places. Find the cube root of the cube of Sum_A, then print the result out without rounding. Explain the result. Copy the output from the shell, put it below your code and comment it out. Output should be of the following form. The underscore are the appropriate numbers.

Q3:

Sum_A is ___________

Sum_B is ___________

The ratio of Sum_A to Sum_B for From,To = 1235,7124, to five decimals, is _________

The cube root of the cube of Sum_A is ________________

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PYTHON CODE :

BECAUSE OF IDENTATION PROBLEM IAM SUMITTING CODE THROUGH SCREENSHOT :

def SumOfSqrofInts_A(From, To) : SA = 0 for i in range(From, To+1) : SA += i*i # sum of squares return SA # return Sum A def

OUTPUT :

Sum_A is 119915855865 # prints sum of A

Sum_B is 119915855865 # prints sum of B

The ratio of Sum_A to Sum_B for From,To = 1235,7124, to five decimals, is 1.00000 # ratio of sum_A and sum_B

The cube root of the cube of Sum_A is 5.7478917388566785e + 32 # cuberoot of cube of sum_A

Add a comment
Know the answer?
Add Answer to:
PYTHON! If From = 1235, To = 7124, take Sum_A = SumOfSqrOfInts_A(From,To) Sum_B = SumOfSqrOfInts_B(From,To) Find...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN PYTHON Print out a table of powers. Use a for loop that goes from 101 to 112 inclusive. Print out r, r squared, r cub...

    IN PYTHON Print out a table of powers. Use a for loop that goes from 101 to 112 inclusive. Print out r, r squared, r cubed, square root of r, and cube root of r. Use two decimal places for the roots, and zero decimal places for the squares and cubes, and 2 decimal places for the averages. Use commas in numbers 1000 and above. After the loop, print out the average of the r squared and r cubed. Use...

  • Your mission in this programming assignment is to create a Python program that will take an...

    Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents.   Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...

  • 1 Show the output from the following Python code fragment: for i in [ 12, 4,...

    1 Show the output from the following Python code fragment: for i in [ 12, 4, -2]:      print (2 * i) 2 Write a Python program findAverage to find the average of the numbers in a range defined by two inputs num1 and num2, where the values of num1 and num2 are entered by the user. For example, a call to findAverage(2,10) would find the average of the numbers 2,3,4,5,6,7,8,9 (note the final "10" is NOT included!). The output...

  • I am working on Exercise 5.8 from Fundamentals of Python 2nd edition. Do you have a...

    I am working on Exercise 5.8 from Fundamentals of Python 2nd edition. Do you have a solution for this item? Thank you. Here is the code I have. I just need 1 instance of each to show in my output. should look like: AM 3 I 3 SAM 3 Thank you... # Put your code here #fileName = input("Enter the file name: ") fileName = "example.txt" #fileName = "kgtest.txt" inputFile = open(fileName, 'r') text = inputFile.read() #print(text) words = text.split()...

  • This problem demonstrates the use of import module. The Python programming language has many strengths, but...

    This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...

  • 1) Which of the following is NOT true about a Python variable? a) A Python variable...

    1) Which of the following is NOT true about a Python variable? a) A Python variable must have a value b) A Python variable can be deleted c) The lifetime of a Python variable is the whole duration of a program execution.   d) A Python variable can have the value None.        2) Given the code segment:        What is the result of executing the code segment? a) Syntax error b) Runtime error c) No error      d) Logic error 3) What...

  • Only do Q2 please!!! please Type the code in python!!!thanks Only do Q2 please!!! please Type...

    Only do Q2 please!!! please Type the code in python!!!thanks Only do Q2 please!!! please Type the code in python!!!thanks 1. (10 points) (Without Python) Unfortunately, Eddard is lost in the dark dungeon of the Red Keep. He knows there are three doors, and one of the doors will lead him to freedom. If Eddard takes Door A, he will wander around the dungeon for 3 days and return to where he started If he takes Door B, he will...

  • Python 3.7.2 for language Please comment for each line of code good naming is important 1....

    Python 3.7.2 for language Please comment for each line of code good naming is important 1. Answer the question: what is the Python regular expression pattern that would match a hex color (https://en.wikipedia.org/wiki/Web_colors ) (for example, the pattern that would match an email address is '[\w.-]+@[\w.-]') Write an algorithm for step 3. As part of your algorithm, be sure to describe the pattern you're using to find the win/loss result for each game. Write a program that looks at the...

  • Please provide the general python code needed: Use regular expression to find all of the genes that meet the following c...

    Please provide the general python code needed: Use regular expression to find all of the genes that meet the following criteria. You just have to print out the number of matched genes to standard output (i.e. console). a sequence that is between 10 to 50 bp that has no A or Ts. any nucleotide repeated three times followed by any nucleotide repeated three times. A one or more times, followed by T one or more times, followed by G one...

  • python question 2. In a file called passfail.py, write a Python program to solve the following...

    python question 2. In a file called passfail.py, write a Python program to solve the following problem: Given a file students.txt with the following information for a stu dent: student number, average quiz mark, average assignment mark, midterm exam mark, and final exam mark (where each mark is recorded out of 100), de termine if the student has passed or failed based on the following information: • A student will pass the course if they have a passing mark (50%...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT