πŸ“Š Python
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
πŸ’¬ Discuss
βœ… Correct Answer: (B) rnpn ear

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

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