Home / Programming MCQs / Python MCQs / Question

R

Ram Sharma • 188.81K Points
Coach

Q. What will be the output of the following Python code?

Code:
str1="learn python"

str2=""

str3=""

for x in str1:

    if(x=="r" or x=="n" or x=="p"):

        str2+=x

        pass

    if(x=="r" or x=="e" or x=="a"):

        str3+=x

print(str2,end=" ")

print(str3)
(A) rnpn ea
(B) rnpn ear
(C) rnp ea
(D) rnp ear

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.