Question

12x11pts-132 pts) This part contains short-answer questions. All these questions involve code fragments (either to be read by you, or written by you). 1. Consider the following lines of code typed in the Python shell. What is the output? Show your work by drawing the scope diagram so you may receive partial credit in case of an incorrect answer. >>a 2 >>C- 6 >>> def someFun (a, b): global c a-b+c b=a+c c a +b print (a, b, c) >>>someFun (a, b) >>> print (a, b, c) >someFun (b, c) >>>print (a, b, c) # What is the output? # What is the output? # What is the output? # What is the output? Answer:
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Screenshot of the code & output

Python 3.7.0 Shell File Edit Shell Debug Options Window Help Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Inte 1)] on win32 Type copyright, credits or license()for more information. >>def some Fun (a,b): global c c- a+ b print (a,b,c) >SomeFun (a, b) 10 16 26 >> print (a, b, c) 2 4 26 >SomeFun (b, c) 52 78 130 >> print (a, b, c) 2 4 130 Ln: 22 Col: 4

Add a comment
Know the answer?
Add Answer to:
12x11pts-132 pts) This part contains short-answer questions. All these questions involve code fragments (either to be...
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
  • 1. Questions Python Code: For each line of code, write the type of error (syntax, semantics,...

    1. Questions Python Code: For each line of code, write the type of error (syntax, semantics, runt-time), cause of the error, and your fix. (1) def fun(num letter) (2) num == 7 + num (3) return 'num' - letter (4) result = fun(5, x) 2. Question Python Code: Run the code below to check the outputs of the print() call on lines 12. And : A) Analyze the application of the accumulation pattern and answer the following questions: #1. a....

  • In the lectures about lists we have seen some Python code examples that involve the processing of...

    In the lectures about lists we have seen some Python code examples that involve the processing of lists containing weather statistics. The original source of the values shown in the slides was taken from part of the Environment Canada website that serves up historical data: http://climate.weather.gc.ca/historical_data/search_historic_data_e.html    Data can be provied by that website using the Comma Separated Value (CSV) format which is stored in text files normally using a CSV suffix. We will not work directly with such files in...

  • Hi, I need some help finishing the last part of this Python 1 code. The last...

    Hi, I need some help finishing the last part of this Python 1 code. The last few functions are incomplete. Thank you. The instructions were: The program has three functions in it. I’ve written all of break_into_list_of_words()--DO NOT CHANGE THIS ONE. All it does is break the very long poem into a list of individual words. Some of what it's doing will not make much sense to you until we get to the strings chapter, and that's fine--that's part of...

  • java (data structures) 8) Suppose you have the following code: :ArrayOrderedList myL = new ArrayOrderedList( );...

    java (data structures) 8) Suppose you have the following code: :ArrayOrderedList myL = new ArrayOrderedList( ); Iterator it = myL.iterator( ); //answer the following questions: a) What does the method, iterator( ) return? b) According the use above, where is this iterator( ) method written? c) Write the lines of code (loop) to print all the Student data in the ordered list using the iterator, it.

  • To insure that file output is written to the disk you need to execute what method?...

    To insure that file output is written to the disk you need to execute what method? a. commit() b. write() c. close() d. complete() The following is called the ________ of a function. def myFunction(x,y) : a. header b. footer c. sentinel d. index True or False: A commonly used program that uses regular expressions is grep. True or False: In Python exception handling provides a mechanism for passing control from the point of the error detection to a handler...

  • Please answer this question using python programming only and provide a screen short for this code....

    Please answer this question using python programming only and provide a screen short for this code. Homework 3 - Multiples not less than a number Question 1 (out of 3) This homework is a SOLO assignment. While generally I encourage you to help one another to learn the material, you may only submit code that you have composed and that you understand. Use this template to write a Python 3 program that calculates the nearest multiple of a number that...

  • Question 1 The code used to output messages to the screen begins with run # print...

    Question 1 The code used to output messages to the screen begins with run # print output Flag this Question Question 2 The code used to begin a comment in the Python program source code is # Hello * Comment Flag this Question Question 3 A variable name is like a(n) input typed on a keyboard address in computer memory where values can be stored output to a computer screen value assigned to an address in computer memory Flag this...

  • 6. (Short answer) The C++ code below is very close to working, but, as written, won't...

    6. (Short answer) The C++ code below is very close to working, but, as written, won't compile. When trying to compile, the compiler generates a number of errors similar to "cout' was not declared in this scope." Respond to the prompts below about the code.(20 points, 5 points each) #include <iostream> void FindMax(int a, int b, int& max) { if (a > b) max = a; else { max = b; } int main() { int num1 = 0; int...

  • Question 18 CLO3 Analyze the following code and answer the questions that follow def F(n): If n <= 1: return n else: return F(n-1)+F(n-2) for i in range (n) print (F(i)) Result: 0 1 1 2 3 5 8...

    Question 18 CLO3 Analyze the following code and answer the questions that follow def F(n): If n <= 1: return n else: return F(n-1)+F(n-2) for i in range (n) print (F(i)) Result: 0 1 1 2 3 5 8 13 a. Write number of operations as a function when the code is execute b If n 7, what is the total number of operations? c. What is the complexity of the algorithm behind the code? (2 Marks) (2 Marks) (1...

  • х сув мм Full Name (Print please) ITM 330 Final Exam. Fall 2018 Multiple Choice (questions...

    х сув мм Full Name (Print please) ITM 330 Final Exam. Fall 2018 Multiple Choice (questions 1- 41,2 points each. Mark your answer on the Scantron for these questions) 1. Consider the following code segment, how many times the while loop iterates? the Sum 10 number input('Enter a number:') while int number): thesum float(number) number int(number) - 1 None Zero or more None of the above b. At least one Ten 2. Pseudocode is an) a) hybrid language of all...

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