A

Admin • 833K 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
  • Correct Answer - Option(B)
  • Views: 24
  • Filed under category Python
  • Hashtags:

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.

Be the first to start discuss.