JavaScript - Exes and Ohs | Codewars 7KYU

  Рет қаралды 196

Wrt Tech

Wrt Tech

Күн бұрын

using Javascript, we solve the Exes and Ohs problem on codewars

Пікірлер: 5
@KaranPatel-gl4zo
@KaranPatel-gl4zo 7 ай бұрын
Could you show us it in python? This is the farthest i got but i fail the last test to return true if the string is empty or None: def xo(s): news = s.lower() for char in news: if not "x" and "o": return True elif news.count("x") == news.count("o"): return True elif news == None: return True else: return False
@wrttech422
@wrttech422 7 ай бұрын
Just do this: def xo(s): s = s.lower() return s.count('x') == s.count('o')
@ParasProgramming123
@ParasProgramming123 11 ай бұрын
Why did you do +1 in count function
@wrttech422
@wrttech422 11 ай бұрын
The acc variable keeps track of the frequency of x and o in our array. Each time value is equal to x or o, we add 1 to the acc variable. The reduce function returns the acc variable at the end after iterating through each element in the array.
@ParasProgramming123
@ParasProgramming123 11 ай бұрын
@@wrttech422 ok thanks
JavaScript Arrays Crash Course
6:04
Web Dev Simplified
Рет қаралды 105 М.
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 11 МЛН
Please Help This Poor Boy 🙏
00:40
Alan Chikin Chow
Рет қаралды 22 МЛН
Spread and REST operators in Javascript
14:00
Hitesh Choudhary
Рет қаралды 55 М.
How to Use Codewars Platform
13:03
AltCampus
Рет қаралды 27 М.
Multi-level Inheritance In Python Is Easy!🐍
3:40
Yousef Computer Science
Рет қаралды 21
Python vs C++ Speed Comparison
1:04
The Builder
Рет қаралды 2,1 МЛН
Valid Parentheses  - Leetcode (Python)
13:24
Akhil Kulkarni
Рет қаралды 41
Python's Walrus Operator??
2:39
b001
Рет қаралды 125 М.
Learn JavaScript With This ONE Project!
1:10:26
Tech With Tim
Рет қаралды 728 М.
forEach Array Method | JavaScript Tutorial
5:03
Florin Pop
Рет қаралды 234 М.
Spread Syntax | ...args | JavaScript
2:49
Telusko
Рет қаралды 14 М.
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 11 МЛН