Answer the question
In order to leave comments, you need to log in
How do you include libraries in gulp?
Hello everyone, tell me how you connect the library in Galpa? Personally, I came to the conclusion that the most adequate way is to either connect everything via cdn, or download it to the lib folder, copy it and connect from it, because if the library needs fonts or pictures, doing something else is hell. But the downside, of course, is that there will be more requests to the server. and .. in general, I see a minus only in this, but it's cdn, which is faster. What do you think about this method?
I don’t consider the bower option at all, the developers themselves said about his death, I don’t understand who uses it and why. The npm option is good, but the problem starts when the library needs some fonts and pictures. Do a task for this? I do not want. Copy them to the source folder? And then what's the point in npm if part of the library will lie as static? I don’t see much more options, in general, tell me how you do it? There is really still webpack, but I don’t want to use it on mini projects, where it will still be superfluous.
Answer the question
In order to leave comments, you need to log in
def comfort_count(temperatures):
print('Количество комфортных дней в этом месяце:',
sum(21 < t < 27 for t in temperatures))
def comfort_count(temperatures):
f = 0
for temp in temperatures:
if temp >= 22 and temp <= 26:
f = f + 1
print("Количество комфортных дней в этом месяце " + str(f))
print('Количество комфортных дней: ', len(list(filter(lambda x: x>=22 and x<=26, may_2018))))
def comfort_count(temperatures):
x = 0
for temp in temperatures:
if temp >= 22 and temp <= 26:
x = x + 1
print('Количество комфортных дней в этом месяце:', x)
Note that the 'print()' function is indented 4 spaces from the 'comfort_count' function declaration block.
If the goal of the task is to do through cycles, then examples have already been given here. And if you just solve the problem in a shorter way, then you can write it like this (without sum in this version):
def comfort_count(temperatures):
return len([t for t in temperatures if 22 <= t <= 26])
It turned out like this:
may_2017 = [24, 26, 15, 10, 15, 19, 10, 1, 4, 7, 7, 7, 12, 14, 17, 8, 9, 19, 21, 22, 11, 15, 19, 23, 15, 21, 16, 13, 25,
17, 19]
may_2018 = [20, 27, 23, 18, 24, 16, 20, 24, 18, 15, 19, 25, 24, 26, 19, 24, 25, 21, 17, 11, 20, 21, 22, 23, 18, 20, 23,
18, 22, 23, 11]
def comfort_count(temperatures):
comfort = 0
for i in temperatures:
if 22 <= i <= 26:
comfort +=1
print('Количество комфортных дней в этом месяце:',comfort)
# дальше код не меняйте
comfort_count(may_2017) # узнаем, что было в мае 2017 г.
comfort_count(may_2018) # узнаем, что было в мае 2018 г.
Result
Number of comfortable days this month: 5
Number of comfortable days this month: 13
Why is there a assembler for a landing page at all ??? If you do not understand in what situations the collector is needed, it's useless to use it. The "masters" collect one page on Sass , Pag , WebPack and what Laravel they hang up for backing. Yes, you can write this page manually in one html file with inline css and js in the basement faster than setting up all this fashionable tools. But it will be loaded instantly and if you have to change the color of the button, you don’t have to remember for an hour where you have what is going and how to start it. The machine gun is a good weapon against the crowd, but it is not effective to shoot sparrows with it.
Without copying assets: pictures and fonts to a folder of ready-to-use code (dist), it will not work. NPM automates the update of dependencies, the dist folder is cleaned every time and only fresh assets are thrown there. To be honest, there aren't many npm packages that use image fonts. More often it's just SASS or JS, which are perfectly assembled from the node_modules folder without any copying.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question