MCQs > IT & Programming > Python > Which option is true regarding these two code samples? Code sample 1: def main(): for i in xrange(10**8): pass main() Code sample 2: for i in xrange(10**8): pass

Python MCQs

Which of the following options are true regarding these two code samples?

Code sample 1:

 def main():

  for i in xrange(10**8):

   pass

 main()

Code sample 2:

 for i in xrange(10**8):

  pass

Answer

Correct Answer: Code sample 2 would take a longer time to complete than code sample 1. This is because in code sample 1, 'i' is local, whereas in code sample 2 it is global.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it