40
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Hi, I have a few comments:
1. Lines 47-50: if...else is "misused", you could write:
if alpha != j:
out_tup.append(j)
2. Lines 33-36: Use list comprehension instead. You use elsewhere in you code, so why not here?
j = [i for in self.connections if len(i) == 2]
3. _
More
Hi, one comment: I would replace lines 13-15 with one line:
# You can apply map(int, ) directly on splitted_data
# and use it as argument of date
year, month, day = map(int, splited_data[0].split('-'))
# In fact you can eliminate these these three variables
call_data
More
Hi, you don't need list comprehension at all:
1. [] are redundant.
2. Look at _filter()_.
More
Hi,
1. `sum(array) * len(array)` is redundant you can `return 0`.
2. If `array` is not empty then `array[len(array)] == array[-1]`.
More
Hi, all the nested `if`s are redundant. __bool__ is subclass of __int__. You could write e. g.:
elif operation == 'equivalence':
return x == y
More
It's a bit "overlamdized" :)
A small tip:
# Change b, c in a way you don't need to use not
# and then you can write:
return a(data) and b(data) and c(data)
# what you could transform
return all((a(data), b(data), c(data)))
# and finally:
return all(f(data) for
More
Hi, some advices:
# 1. You can use negative indexes
array[len(array) - 1] == array[-1]
# 2. You don't need the z variable:
array[::2] == array[:len(array):2]
# 3. sum is not a good variable name, as there's a built-in function called __sum__.
More
Hi, as phrases is a sequence of strings you don't need str(x) so you could write:
",".join(phrases)
More
Hi,
1. __str__ is iterable. You could write `alphabet = "abcde...xyz"`
2. or `from string import ascii_lowercase`.
More
Hi even it's marked as Creative: To my mind __is not__ is not (:)) the correct comparison here. It should be !=.
More
Hi _chr.isupper()_ returns a boolean value so == True is redundant.
More
Hi, few things:
1. That `if (i == 0): print('Nope')` is redundant.
2. You could write `if not i: total *= i`.
3. Look at _functools.reduce()_.
4. `newNumber = map(int,str(number))` is enough as _map()_ returns an iterable.
More
Hi, __str__ type is immutable, so it is not the best choice for accumulating values (I mean: `answer += achar`. Look at _filter()_ and _str.join()_.
More