Xs and Os Nobody Knows Edabit Python Programming

Problem:- Create a function that takes a string, checks, if it has the same number of "x"s and "o"s, and returns either True or False.

  • Return a boolean value (True or False).
  • Return True if the number of x's and o's are the same.
  • Return False if they aren't the same amount.
  • The string can contain any character.
  • When "x" and "o" are not in the string, return True.
Code :-

  1. Simple Solustion:-
Solution Code

        2. Using dictionary comprehension:-

Solution Code

Note:- Never miss indentation. If you are stuck check the python documentation. Suggestions and comments are always welcome.

Comments