40
suic
16 39 57
9966/ 10664
Last seen 1 day ago
Member for 9 years, 11 months, 4 days
Difficulty Advanced
Best reviews / Newest reviews
First-jantechner
Hi, this isn't very Pythonic :( I'm wondering how it got 57 upvotes. ```python from math import acos, degrees ​ def is_correct_triangle(a,b,c): return a+b>c and a+c>b and c+b>a def angle(a,b,c): d = (a**2 + b**2 - c**2)/(2*a*b) return round(degrees(acos(d))) def checkio More
numbers-weroniquue
Hi, this is doable without `if` as `and` is Python is short-circuiting: `return len(args) and max(args) - min(args)`. Regards, suic More
absolute-weroniquue
Hi, `sorted()` doesn't modify the `number_array` variable => you can omit `x`. More
dsd-weroniquue
Hi, 1. you can save an `int()` conversion 2. you canremove the `liczba` variable 3. other way of solving this mission is using `filter()` and `reduce()` I'm not saying that either of the below solution is better than yours :) My point is that this type of refactoring is useful for exploring Pytho More
binarne-weroniquue
Hi, nice math-based solution. :) few Python tweaks: 1. `divmod()` is an excellent built-in function. 2. __`str`__ has `str.count()` method, which can do the work for you: `bin(number).count('1')` as `bin()` returns a __`str`__. Regards, suic ```python # divmod def checkio(number): wynik = 0 More
even the last-weroniquue 1
Hi, I this case you let Python to do the work fork you: ```python ostatni = array[-1] suma = sum(lista)` # or even suma = sum(array[::2]) ``` You don't need the `else` branch. Regards, suic P. S.: Jest to jakas praca domowa? More
Bitwise XOR and string manipulation-paren8esis 1 1
Hi, `bin()` returns a __`str`__ so `str()` is redundant. More
Actual bit manipulation-pvdwijdeven 1 1
Hi, let's have a look at your `get_bin` function: ```python def get_bin(number): return (list(map(int, list(str(bin(number))[2:])))) ``` 1. `bin()` returns a __`str`__ => __`str`__ is redundant. 2. __`str`__ is iterable => `list` is redundant. ```python def get_bin(number): return list(map More
First-mihrarty
Hi, 1. Instead of lines 10-14 you can write: `return sum(x[0]!=x[1] for x in zip(*(map(int, i) for i in (x, y))))`. 2. Look at `^` (alias `xor`) operator. Regards, Gabriel More
First-austin.huff
Hi, #### In Python you usually iterate over elements ```python def find_message(text): msg = "" for char in text: if 65 <= ord(char) <= 90: msg += char # shorthand return msg ``` #### How to check if string is uppercase ```python 65 <= ord(char) <= 90 'A' <= char < More
First-austin.huff
Hi, 1. Line 2 is redundant: __tuple__ is iterable. 2. Line 3 and 4 are redundant: `return ','.join(x).replace('right', 'left')` Regards, suic More
What's wrong?-suic
This solution is for demonstration purposes ([see](https://py.checkio.org/forum/post/10113/help-please/)). More
First - one_linear-msmyxz 1 1
Hi, 1. `[]` are redundant :) `sorted` takes any iterable including generator expressions. 2. If you assign `f = first.split(',')` and `s = second.split(',')`, you perform the splitting only once per each word. Regards, suic More
First-pruidzeko
Hi, instead of the condition on line 6 you could write: sum(i.isdigit() for i in data) # or even better any(i.isdigit() for i in data) Other option is to combine _sum()_ and _filter()_ sum(filter(str.isdigit, data)) More
Clear -Vesemir
Hi, nice solution, but why don't you returned the condition? return len(data) >= 10 and contains_digits(data) and contains_upper(data) and contains_lower(data) \-----------------------------------------------------------------------------------------/ More
First-edutilos 1
Hi, I'm sorry, but this is quite un-pythonic. I'm wondering how this could get 13 votes. Let me explain: 1. Lines 18-21. This is an anti-pattern. Your condition is a __bool__ which you can directly return: `return num and lower and upper` 2. This isn't pythonic: `for i in range(len(data)):`. Norma More
One line regex-SimonTC
Nice _perlish_ line noise! Good job! More
First-srinish.rawoor
Hi, there's is quite a lot of redundancy in this solution: return len(data)>=10 and all(re.search(pat, data) for pat in ('[0-9]+' ,'[A-Z]+', '[a-z]+')): and also an anti-pattern: if cond: return True else: return False # is the same as return bool(cond) More
xor & sum-RadekBrich 1
Hi, _list()_ is redundant as __str__ is iterable. More
Numpy-paolo.brasolin 1 1
Hi, nice one. You can shorten it a bit (see [this](https://checkio.org/mission/median/publications/suic/python-3/variation-on-paolobrasolins-theme/)). :) More