| |

Question: In python you should avoid using global variables because opt– Free Chegg Question Answer

In python you should avoid using global variables because

options(checkbox)

python computes local variables quicker

global variables increase scope and memory footprint

global variables override local variables

why do we want to write efficient code

options(checkbox)

we want to reduce the runtime

we want to reduce the memory footprint of the code

we want to reduce the statements in the code

we want to reduce the compile time of the code

why do we refactor code

options(checkbox)

to rename code to following an intention revealing name

we want to encapsulate fields

we want to extract classes

we want to pushdown methods to protect them in a class

note: there may be more than one answer in each questions!!

Transcribed text From Image: 

Expert Chegg Question Answer:

free chegg question answer
Smart Teacher From Answerie.com
Answer:

Answer


(Ans)

(1)

** In python you should avoid using global variables because global variables have no access control i.e increases scope and memory footprint by causing namespace pollution.

–> Therefore the answer is option(2).

(2)

** We want to write efficient code because it decreases the time and space complexity by increasing the functionality of the code with minimum number of statements.

–> Therefore the answer is options (1), (2), (3) and (4).

As we strictly instructed to solve only the first question. So I have solved two questions for your convenience. Hope you understand


Free Chegg Question Answer

Leave a Reply

Your email address will not be published. Required fields are marked *