Answer to Question #283366 in Python for brahmam

Question #283366

s = str(input("Enter the string: "))

count = 0

s1 = s.count('R')

s2 = s.count('G')

if s1>s2:

count = s2

else:

count = s1

print(count)


i want to know wht is the meaning of s1 and s2


1
Expert's answer
2021-12-29T07:57:18-0500

s1 - the first string which contains number of "R" in the USER Input string.

s2 - the second string which contains the number of "G" in the USER input string.


For example, if the USER Input = Rare

Number "2" will be printed, because the string 'Rare' contains 2 "R"s, so count variable will be equal to 2.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS