What will be the output of the following Python code?def ct(): global x print(x) x = "hii" print(x) x = "welcome" ct()print(x)Optionshiihiiwelcomewelcomehiihiihiiwelcomewelcomewelcomehiiwelcome
Question
What will be the output of the following Python code?def ct(): global x print(x) x = "hii" print(x) x = "welcome" ct()print(x)Optionshiihiiwelcomewelcomehiihiihiiwelcomewelcomewelcomehiiwelcome
Solution
The output of the Python code will be:
welcome hii hii
Similar Questions
What will be the output of the following Python code?def ct(y): global y y+=2 print(y)ct(5)print("hi")Optionserrorhi77hi
What will be the output of the following Python code?def ct(): y=9 print(y)y=7ct()OptionsError9977
What will be the output of the following Python code?def ct(y): print(y+2)y=-6y=3ct(8)Options10453
What will be the output of the following Python code?>>>ct1="codetantra">>>ct1[:3]>>>Optionscododetacodetantrade
What will be the output of the following Python code?def ct(x, y, z): global a x = 5 y = 6 z = 7 a = 8 print(x,y,z,a)x,y,z,a = 15,16,17,18ct(1,3,9)Options15 16 17 181 5 9 185 6 7 81 5 9 8
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.