What is the output of the following code snippet? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of the following code snippet?

What is the output of the following code snippet? def ChangeVal(M,N): for i in range(N): if M[i]%5 == 0: M[i]//=5 if M[i]%3 == 0: M[i]//=3 L = [25,8,75,12] ChangeVal(L,4) for i in L: print(i,end="#") pls tell me what will be answer for M[2].

13th Sep 2023, 12:11 PM
Oikawa Tōru
Oikawa Tōru - avatar
3 Answers
+ 6
Oikawa Tōru , Run the code in code-playground to see what is the output.... BTW, Python is case sensitive...so make ChangeVal into lower-case.... The above code should be like this with proper indentation.... def changeval(M,N): for i in range(N): if M[i]%5 == 0: M[i]//=5 if M[i]%3 == 0: M[i]//=3 L = [25,8,75,12] changeval(L,4) for i in L: print(i,end="#")
13th Sep 2023, 12:18 PM
Riya
Riya - avatar
+ 5
are you sure this code is correct? 🤔 what about indentation? please copy the code into your code repository in the code playground, save it and post the link to the code in your question.
13th Sep 2023, 12:18 PM
Jan Markus
0
I can barely understand this or it will take me alot if time figure out the answer. I advise you to copy the code well indented and ask again we shall help you. It's very good if you just share the link from the playground of sololearn.
13th Sep 2023, 9:33 PM
Uniq-L
Uniq-L - avatar