## Learning – Counting correct questions

Can someone explain to me the function of the line "question + = 1"I am a beginner and I am trying to understand the logic behind the code and not just make it work.

``````> pontos = 0 questao = 1 while questao <=3:
>     resposta = input('Resposta da questão {}: '.format(questao))
>     if questao == 1 and resposta == 'b':
>         pontos = pontos + 1
>     if questao == 2 and resposta == 'a':
>         pontos = pontos + 1
>     if questao == 3 and resposta == 'd':
>         pontos = pontos + 1
>     questao +=1 print('O aluno fez {} pontos'.format(pontos))
``````

## programming challenge – Problem nº 17 of the Euler Project, counting of letters of numbers, in Python

Problem statement: if the numbers from 1 to 5 are written in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.

If all numbers from 1 to 1000 (thousand) inclusive were written in words, how many letters would be used?

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing numbers complies with British usage. Here is my implementation in Python, waiting for your comments.

``````def number_to_word (n):
"" "Suppose it is an integer from 1 to 1000.
Returns the number in ex words: 122 -> one hundred and twenty-two. "" "
# num_to_alpha contains the unique values ​​for the numbers that will be returned according to repetitive patterns
num_to_alpha =
{1: & # 39 ;, 2: & # 39 ;, 3: & # 39 ;, 4: & # 39 ;, 5, & # 39 ; five & # 39 ;, 6: & # 39 ;, 7: & # 39 ;, 8: & # 39 ;, 9: & # 39; nine & # 39 ;, 10: & # 39; ten & # 39 ;,
11: & # 39 ;, 12: & # 39 ;, 13: & # 39 ;, thirteen & # 39 ;, 14: & # 39; fourteen & # 39 ;, 15: & # 39; fifteen & # 39 ;, 16: & # 39; sixteen & # 39 ;, 17: & # 39; seventeen & # 39 ;,
18: & # 39; eighteen & # 39 ;, 19: & # 39; nineteen & # 39 ;, 20: & # 39 ;, 30: & # 39; thirty & # 39 ;, 40: & # 39; forty & # 39 ;, 50: & # 39; fifty & # 39 ;, 60: & # 39; sixty & # 39 ;,
70: & # 39; seventy & # 39 ;, 80: & # 39 ;, eighty & # 39 ;, 90: & # 39; ninety & # 39 ;, 100: & # 39; one hundred & # 39 ;, 1000: & # 39; thousand & # 39;}
# Numbers under 21, 100, 1000 are unique words (can not be formed using a repetitive rule)
if 0 <n <21 or n == 100 or n == 1000:
returns num_to_alpha[n]
mod = n% 10
# Numbers in the range (21 - 99) have a single rule, except multiples of 10 (formed by a single word)
yes 20 <n <100:
yes n% 10! = 0:
returns f & # 39; {num_to_alpha[n // 10 * 10]} - {num_to_alpha[mod]} & # 39;
returns num_to_alpha[n]
# Numbers above 100 have a single rule, except the following:
yes 100 <n < 1000:
# a) multiples of 100
if n % 100 == 0:
return f'{num_to_alpha[n // 100]} hundred'
# b) numbers whose last 2 digits are above 20 and are also multiples of 10
if not n % 100 == 0 and n % 100 > 20 and n% 10 == 0:
returns f & # 39; {num_to_alpha[n // 100]} one hundred and {num_to_alpha[n % 100]} & # 39;
# c) numbers whose last 2 digits are below 20 and not multiples of 10
yes n% 100 < 21:
second_part = num_to_alpha[n % 100]
return f'{num_to_alpha[n // 100]} hundred and {second_part}'
# d) numbers whose last 2 digits are above 20 and not multiples of 10
if n % 100 > twenty:
returns f & # 39; {num_to_alpha[n // 100]} one hundred and {num_to_alpha[((n % 100) // 10) * 10]} - & # 39;
f & # 39; {num_to_alpha[(n % 100) % 10]} & # 39;
# To avoid counting false values
without <= 0 or n > 1000:
come back & # 39; & # 39;

def account ():
"" "Clean spaces and hyphens numbers and count returns." ""
all_numbers = [number_to_word(x) for x in range(1, 1001)]
numbers_without_spaces = [number.replace(' ', '') for number in all_numbers]
clean_numbers = [number.replace('-', '') for number in numbers_without_spaces]
total = 0
for clean_number in clean_numbers:
total + = len (clean_number)
total return

yes __name__ == & # 39; __ main __ & # 39;
print (count ())
``````

## javascript – Counting Valleys – HackerRank Challenge – Filter the elements of the matrix that are equal to the previous element

For this challenge in HackerRank:

A valley is a sequence of consecutive steps below sea level, which begins with a step down from sea level and ends with a step towards sea level.

Given the sequence of steps up and down Gary during his last walk, find and print the amount of valleys he walked through.

For example, if Gary's route is s =[DDUUUUDD], first enter a valley of 2 units deep. Then climb and climb a mountain of 2 units in height. Finally, return to sea level and finish the trek.

I came up with a solution, but I'm sure it can be optimized:

``````function countingValleys (n, s) {
leave heighttracker = [];
leave height = 0;
for (be i = 0; i <s.length; i ++) {
yes[i] === "D") {
height--;
heightTracker.push (height);
}
yes[i] === "U") {
height ++;
heightTracker.push (height);
}
}
leave planeTracker = [];
for (be j = 0; j <heightTracker.length; j ++) {
yes (heighttracker)[j] < 0) {
planeTracker.push("valley");
}
if (heightTracker[j] >    0) {
planeTracker.push ("mountain");
}
yes (heighttracker)[j] === 0) {
planeTracker.push ("plane");
}
}
leave newArray = [];
for (be k = 0; k <planeTracker.length; k ++) {
yes[k] === planeTracker[k - 1]) {
continue;
}
yes[k] ! == planeTracker[k - 1]) {
newArray.push (planeTracker[k]);
}
}
let's say valleyCount = 0;
for (be l = 0; l <newArray.length; l ++) {
if (newArray[l] === "valley") {
valleyCount ++;
}
}
return valleyCount;
}
``````

My logic was to keep track of all negative and positive values ​​in `s`.

• Yes `height tracker[j]` is negative, push "valley" in `avionist`
• Yes `height tracker[j]` it's positive, push "mountain" in `avionist`
• Otherwise, push "flat" on `avionist`

So at that point, I'm left with:

`[ 'valley', 'valley', 'valley', 'flat', 'valley', 'valley', 'valley', 'valley', 'valley', 'flat', 'mountain', 'flat' ]`

And I wonder, is there any way to filter elements that are the same as the previous elements? The objective was to generate the matrix:

`[ 'valley', 'flat', 'valley', 'flat', 'mountain', 'flat']` and then count the number of times the word "valley" appears in that matrix. As you can see, I did this with a for loop. But I wonder what other suggestions you would have, maybe the `.filter()` method?

## python – Custom model for counting user interaction in the application

In the language dictionary application, users can add new words and make another word with this word, such as adding additional information to the word (description, etymology, parts of speech, class of nouns, etc.). I will tell all this information and Maybe then I'll create some application. Gamification based on this information. I decided to create a personalized model and count all this contribution within this model. There is a basic abstract model that defines common fields:

``````BaseModel class (models.Model, ModelDiffMixin):
WORD_MODERATE_STATUS = [
('UNDER_CONCIDERATION', 'under consideration'),
('PREVIOUSLY_ACCEPTED', 'previously accepted')
]
max_length = 50, options = WORD_MODERATE_STATUS, blank = True)
created_on = models.DateTimeField (auto_now_add = True)
modified_on = models.DateTimeField (auto_now = True)
created_by = models.ForeignKey (
related_name = & # 39;% (class) s_createdby & # 39;)
modified_by = models.ForeignKey (
related_name = & # 39;% (class) s_modifiedby & # 39 ;, null = True, blank = True)
accepted = models. Sand field (default = False)
accept_by = models.ForeignKey (
related_name = & # 39;% (class) s_acceptedby & # 39;)

Target class:
abstract = true
``````

And then I found a solution to see the field change and, based on this, I created. `post_save` signal that updates the desired field value.

``````ModelDiffMixin class (object):
""
A model mix that tracks the values ​​of the model fields and provides a useful api
To know which fields have been changed.
""

def __init __ (self, * args, ** kwargs):
super (ModelDiffMixin, self) .__ init __ (* args, ** kwargs)
self .__ initial = self._dict

@property
def diff (self):
d1 = initial auto .__
d2 = self._dict
diffs = [(k, (v, d2[k])) for k, v in d1.items () if v! = d2[k]]back dict (dif)

@property
def has changed (auto):
return bool (self.diff)

@property
def changed_fields (self):
returns self.diff.keys ()

def get_field_diff (self, field_name):
""
Returns a diff field for if it has changed and None otherwise.
""
return self.diff.get (field_name, None)

def save (self, * args, ** kwargs):
""
Save the model and set the initial state.
""
super (ModelDiffMixin, self) .save (* args, ** kwargs)
self .__ initial = self._dict

@property
def _dict (self):
returns model_to_dict (
self, fields =[field.name for field in self._meta.fields])
``````

By using this mix, I will be able to verify which field values ​​were changed and update the user statistics respectively. Here is the basic model of the word `WordCoreModel` in which users can perform some manipulations of data through front-ent (using Django's REST framework):

``````CoreWordCategoryModel class (models.Model):
core_abbreviation = models.CharField (max_length = 10, blank = True)
core_description = models.CharField (max_length = 50, blank = True)
ru_abbreviation = models.CharField (max_length = 10, blank = True)
ru_description = models.CharField (max_length = 50, blank = True)
en_abbreviation = models.CharField (max_length = 10, blank = True)
en_description = models.CharField (max_length = 50, blank = True)

def __str __ (self):
returns the format "{} - {} - {}". (self.core_description, self.ru_description, self.en_description)

WordCoreModel class (BaseModel):
NOUN_CLASSESS = [
('V_CLASS', 'В класс'),
('Y_CLASS', 'Й класс'),
('Y_CLASS_SECOND', 'Й класс II'),
('D_CLASS', 'Д класс'),
('B_CLASS', 'Б класс'),
('B_CLASS_SECOND', 'Д класс II')
]
PART_OF_SPEECH = [
('NOUN', 'Noun'),
('VERB', 'Verb'),
('PRONOUN', 'Pronoun'),
('PREPOSITION', 'Preposition'),
('CONJUNCTION', 'Conjunction'),
('INTERJECTION', 'Interjection')
]
word_core = models.CharField (max_length = 255, default = "")
word_russian_typed = models.CharField (max_length = 255, default = "", blank = True)
word_english_typed = models.CharField (max_length = 255, default = "", blank = True)

homonyms = models.ManyToManyField (& # 39; self & # 39 ;, blank = True)
synonyms = models.ManyToManyField (& # 39; self & # 39 ;, blank = True)
antonyms = models.ManyToManyField (& # 39; self & # 39 ;, blank = True)

word_category = models.ForeignKey (
related_name = & # 39; wordcategory & # 39 ;, null = True, blank = True)

description = models.TextField (default = "", blank = True)
latin_version = models.CharField (max_length = 255, default = "", blank = True)
transcription = models.CharField (max_length = 255, default = "", blank = True)
ipa = models.CharField (max_length = 200, default = "", blank = True)
root = models.CharField (max_length = 80, default = "", blank = True)
word_class = models.CharField (max_length = 20, choices = NOUN_CLASSESS, blank = True)
part_of_speech = models.CharField (max_length = 20, choices = PART_OF_SPEECH, blank = True)
etymology = models.TextField (default = "", blank = True)

# Singular Declinations
declension_singular_absolutive = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_genitive = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_dative = models.CharField (max_length = 255, default = "", blank = True)
declension_singular_ergative = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_allative = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_instrumental = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_locative_stay = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_locative_direction = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_locative_outcome = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_locative_through = models.CharField (
max_length = 255, default = "", blank = True)
declension_singular_comparative = models.CharField (
max_length = 255, default = "", blank = True)

# Plural Declension
declension_plural_absolutive = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_genitive = models.CharField (max_length = 255, default = "", blank = True)
declension_plural_dative = models.CharField (max_length = 255, default = "", blank = True)
declension_plural_ergative = models.CharField (max_length = 255, default = "", blank = True)
declension_plural_allative = models.CharField (max_length = 255, default = "", blank = True)
declension_plural_instrumental = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_locative_stay = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_locative_direction = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_locative_outcome = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_locative_through = models.CharField (
max_length = 255, default = "", blank = True)
declension_plural_comparative = models.CharField (
max_length = 255, default = "", blank = True)

# Times
imperative_tense_basic_form = models.CharField (max_length = 255, default = "", blank = True)
imperative_tense_causative = models.CharField (max_length = 255, default = "", blank = True)
imperative_tense_permissive = models.CharField (max_length = 255, default = "", blank = True)
imperative_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
imperative_tense_potential = models.CharField (max_length = 255, default = "", blank = True)
imperative_tense_inceptive = models.CharField (max_length = 255, default = "", blank = True)
######
simple_present_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
simple_present_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
simple_present_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
simple_present_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
simple_present_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
simple_present_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
near_preterite_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
near_preterite_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
near_preterite_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
near_preterite_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
near_preterite_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
near_preterite_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
witnessed_past_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
witnessed_past_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
witnessed_past_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
witnessed_past_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
witnessed_past_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
witnessed_past_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
perfect_tense_basic_form = models.CharField (max_length = 255, default = "", blank = True)
perfect_tense_causative = models.CharField (max_length = 255, default = "", blank = True)
perfect_tense_permissive = models.CharField (max_length = 255, default = "", blank = True)
perfect_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
perfect_tense_potential = models.CharField (max_length = 255, default = "", blank = True)
perfect_tense_inceptive = models.CharField (max_length = 255, default = "", blank = True)
######
plusquamperfect_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
plusquamperfect_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
plusquamperfect_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
plusquamperfect_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
plusquamperfect_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
plusquamperfect_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
repeat_past_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
repeat_past_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
repeat_past_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
repeat_past_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
repeat_past_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
repeat_past_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
possible_future_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
possible_future_tense_causative = models.CharField (
max_length = 255, default = "", blank = True)
possible_future_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
possible_future_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
possible_future_tense_potential = models.CharField (
max_length = 255, default = "", blank = True)
possible_future_tense_inceptive = models.CharField (
max_length = 255, default = "", blank = True)
######
real_future_tense_basic_form = models.CharField (
max_length = 255, default = "", blank = True)
real_future_tense_causative = models.CharField (max_length = 255, default = "", blank = True)
real_future_tense_permissive = models.CharField (
max_length = 255, default = "", blank = True)
real_future_tense_permissive_causative = models.CharField (
max_length = 255, default = "", blank = True)
real_future_tense_potential = models.CharField (max_length = 255, default = "", blank = True)
real_future_tense_inceptive = models.CharField (max_length = 255, default = "", blank = True)

Target class:
index = [models.Index(fields=['word_core'])]verbose_name = & # 39; Core Word & # 39;
verbose_name_plural = & # 39; Core Words & # 39;

def __str __ (self):
back self.word_core
``````

Add new word or modify word triggers `post_save` Signal and execute the following method:

``````@receiver (post_save, sender = WordCoreModel)
def update_user_statistics (sender, instance, ** kwargs):
yes instance.has_changed and instance.accepted:
changed_fields = instance.changed_fields
for the field in change_fields:
_field = & # 39; {} _added & # 39; .format (field)
If hasattr (UserStats, _field):
user_stats = UserStats.objects.get_or_create (
user_id = instance.modified_by.id)[0]
user_stats.increment (_field)
user_stats.save ()
``````

The custom model to collect all the interaction of the users. `UserStats` It seems (it's huge, but the fields are almost the same, so if I need to change the logic or something like that, just apply it to a field and I'll correct the rest):

``````UserStats class (models.Model):
user = models.OneToOneField (get_user_model (), on_delete = models.CASCADE)
reputation = models.IntegerField (default = 0, blank = True)

word_core_added = models.IntegerField (default = 0, blank = True)
word_russian_typed_added = models.IntegerField (default = 0, blank = True)
word_english_typed_added = models.IntegerField (default = 0, blank = True)

description_added = models.IntegerField (default = 0, blank = True)
latin_version_added = models.IntegerField (default = 0, blank = True)
transcription_added = models.IntegerField (default = 0, blank = True)
ipa_added = models.IntegerField (default = 0, blank = True)

root_added = models.IntegerField (default = 0, blank = True)
prefix_added = models.IntegerField (default = 0, blank = True)
suffix_added = models.IntegerField (default = 0, blank = True)
ending_added = models.IntegerField (default = 0, blank = True)

syllable_added = models.IntegerField (default = 0, blank = True)
phraseologism_added = models.IntegerField (default = 0, blank = True)
source_added = models.IntegerField (default = 0, blank = True)
word_class_added = models.IntegerField (default = 0, blank = True)
part_of_speech_added = models.IntegerField (default = 0, blank = True)
etymology_added = models.IntegerField (default = 0, blank = True)

declension_singular_absolutive_added = models.IntegerField (default = 0, blank = True)
declension_singular_genitive_added = models.IntegerField (default = 0, blank = True)
declension_singular_dative_added = models.IntegerField (default = 0, blank = True)
declension_singular_ergative_added = models.IntegerField (default = 0, blank = True)
declension_singular_allative_added = models.IntegerField (default = 0, blank = True)
declension_singular_instrumental_added = models.IntegerField (default = 0, blank = True)
declension_singular_locative_stay_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
default = 0, blank = True)
default = 0, blank = True)
declension_singular_comparative_added = models.IntegerField (default = 0, blank = True)

declension_plural_absolutive_added = models.IntegerField (default = 0, blank = True)
declension_plural_genitive_added = models.IntegerField (default = 0, blank = True)
declension_plural_dative_added = models.IntegerField (default = 0, blank = True)
declension_plural_ergative_added = models.IntegerField (default = 0, blank = True)
declension_plural_allative_added = models.IntegerField (default = 0, blank = True)
declension_plural_instrumental_added = models.IntegerField (default = 0, blank = True)
declension_plural_locative_stay_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
declension_plural_locative_outcome_added = models.IntegerField (default = 0, blank = True)
declension_plural_locative_through_added = models.IntegerField (default = 0, blank = True)
declension_plural_comparative_added = models.IntegerField (default = 0, blank = True)

imperative_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
imperative_tense_causative_added = models.IntegerField (default = 0, blank = True)
imperative_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
imperative_tense_potential_added = models.IntegerField (default = 0, blank = True)
imperative_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

simple_present_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
simple_present_tense_causative_added = models.IntegerField (default = 0, blank = True)
simple_present_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
simple_present_tense_potential_added = models.IntegerField (default = 0, blank = True)
simple_present_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

near_preterite_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
near_preterite_tense_causative_added = models.IntegerField (default = 0, blank = True)
near_preterite_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
near_preterite_tense_potential_added = models.IntegerField (default = 0, blank = True)
near_preterite_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

witnessed_past_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
witnessed_past_tense_causative_added = models.IntegerField (default = 0, blank = True)
witnessed_past_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
witnessed_past_tense_potential_added = models.IntegerField (default = 0, blank = True)
witnessed_past_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

perfect_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
perfect_tense_causative_added = models.IntegerField (default = 0, blank = True)
perfect_tense_permissive_added = models.IntegerField (default = 0, blank = True)
perfect_tense_permissive_causative_added = models.IntegerField (default = 0, blank = True)
perfect_tense_potential_added = models.IntegerField (default = 0, blank = True)
perfect_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

plusquamperfect_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
plusquamperfect_tense_causative_added = models.IntegerField (default = 0, blank = True)
plusquamperfect_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
plusquamperfect_tense_potential_added = models.IntegerField (default = 0, blank = True)
plusquamperfect_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

repeat_past_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
repeat_past_tense_causative_added = models.IntegerField (default = 0, blank = True)
repeat_past_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
repeat_past_tense_potential_added = models.IntegerField (default = 0, blank = True)
repeat_past_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

possible_future_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
possible_future_tense_causative_added = models.IntegerField (default = 0, blank = True)
possible_future_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
possible_future_tense_potential_added = models.IntegerField (default = 0, blank = True)
possible_future_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

real_future_tense_basic_form_added = models.IntegerField (default = 0, blank = True)
real_future_tense_causative_added = models.IntegerField (default = 0, blank = True)
real_future_tense_permissive_added = models.IntegerField (default = 0, blank = True)
default = 0, blank = True)
real_future_tense_potential_added = models.IntegerField (default = 0, blank = True)
real_future_tense_inceptive_added = models.IntegerField (default = 0, blank = True)

word_category_added = models.IntegerField (default = 0, blank = True)

homonyms_added = models.IntegerField (default = 0, blank = True)
Synonyms_added = models.IntegerField (default = 0, blank = True)
antonyms_added = models.IntegerField (default = 0, blank = True)

increase of def (self, name):
"" "Increase a counter specified by the argument & # 39; name & # 39 ;." ""
auto .__ dict__[name] + = 1
``````

I'm not sure about this `post_save` method. I can exclude counting due to small changes by users, such as changing 1 letter in word or description, etc. through the logic of the "accepted" field in WordCoreModel. Any change will be established `accepted` to `false` until some of the moderators configure it manually `true` again and this will avoid counting statistics on minor changes or abusing the statistics. But another thing is that only the accepted words will be available in the application and configuring them in `false` Every time someone changes it, it's not such a good idea.

## Counting accounts and reporting | Web Hosting Talk

Hi all,

With the #cpanelgate, I need to find a way to monitor accounts on a server or reseller package. I'm thinking that it should be a way of doing this using something like zabbix to monitor an account / server and report when they exceed a pre-set limit.

Any ideas

## probability – counting cars on a highway

When leaving a certain road, the cars turn to the left or to the right,
independently of each other, with a probability of 0.3 to turn left.
Knowing that at least 2 of the last 15 cars that went off the road
rotated to the left, what is the probability that no more than 2 cars actually
Turned to the left?

I used the binomial distribution 15C2 * 0.3 ^ 2 * 0.7 ^ 13 and got 0.0915.
I mean it's close to the actual answer (0.095) but I'm pretty sure I made a mistake somewhere.

## Counting Crows

Who likes this band? It seems to have a strong influence of Van Morrison. Who can play these things on the guitar?

## automatons – Number of counting states of a regular expression

Given the regular expression: $$r = ab + ((a + epsilon) c ^ *) ^ *$$.
Let A be a non-deterministic automaton that accepts the language of r.
How many states are in A?
Answer the question without constructing A explicitly, explain how you got the answer.

I'm having trouble solving this question.
The answer that was given is: $$5 * 2 + 4 * 2 = 18$$

With the explanation that for the $$epsilon$$ Regular expression we build an automaton with 2 states.

for each $$sigma in Sigma$$ for the regular expression $$sigma$$ We build an automaton with 2 states.

For the concatenation, we do not add states and for each union or star operation we add 2 states.

But even with this explanation, I am not sure that they have reached this answer.

I can understand that we have $$epsilon$$, so we have 2. We also have $$Sigma = {a, b, c }$$ we do it like this $$2 * 3$$.

Even with the stars, how do we get to $$5 * 2$$?

Also, I have not seen this type of calculation before, are there any additional rules when trying to calculate states from a regular expression?

## nt.number theory – Probability of counting solutions of a random bivariate modular system in a particular way?

Consider a cousin $$p$$ and a system of $$t$$ shape equations
$$alpha_ix ^ {a_i} and ^ {b_i} + beta_ix ^ {c_i} and ^ {d_i} equiv gamma_i bmod p$$
where $$alpha_i, beta_i, gamma_i in mathbb Z$$ are chosen uniformly in $$[0,p-1]$$ Y $$a_i, b_i, c_i, d_i in mathbb Z$$ they are uniform in $$[0,ell]$$ where $$p / 4 < ell Holds.

What is the probability that the system has a maximum? $$r$$ different solutions $$mod p$$?

I'm more interested in the cases.

1. $$r = 1$$

2. $$t> log p$$.

## javascript – Problem in counting equal values ​​in jQuery DataTable

Goodnight

I have a table and I am trying to filter by equal values ​​in the lines without success. Code to filter (returns the registration number that would be the total number of records);

``````                                                () () () () () () () () () () () () () ()
return value = "New York"? true: false;
})
console.log (filteredData.count ());
\$ ("Sum") HTML (filteredData.count ().);

table:

var table = "";
table = \$ (& # 39 ;. table & # 39;). DataTable ();
``````

table:

``````

first name
position
office
age
city
salary

Tiger Nixon
System Architect
Edinburgh
61
New York
320 800

Garrett Winters
counter
Tokyo
63
New York
170 750

Ashton Cox
Junior Technical Author
San Francisco
66
New York
86,000

Cedric Kelly
Senior Javascript Developer
Edinburgh
22
New York
433 060

Airi Satou
counter
Tokyo
33
New York
162 700

Brielle Williamson
Integral integration
New York
61
New York
372,000

Herrod Chandler
Sales Assistant
San Francisco
59
New York
137,500

Rhona Davidson
Integral integration
Tokyo
55
New York
327 900

``````