πŸ“Š Python
Q. How many local and global variables are there in the following Python code?
Code:
var1=5

def fn():

	var1=2

	var2=var1+5

var1=10

fn()
  • (A) 1 local, 1 global variables
  • (B) 1 local, 2 global variables
  • (C) 2 local, 1 global variables
  • (D) 2 local, 2 global variables
πŸ’¬ Discuss
βœ… Correct Answer: (D) 2 local, 2 global variables

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
315
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
87%
Success Rate