Answer:
for ( initialization; condition;increment)
{
code goes here;
}
in python:
for i in list/range:
code with proper indentation
By initialization above we mean, like int i=0; etc.
By condition like i<10;
and by increment it means like i++, ++i or i+=1; etc
And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.
Explanation:
Please check the answer section.
Answer:
China and Michigan hskbvd
Answer:
optical sensors
Explanation:
optical sensors measure the amount of gases like carbon dioxide and carbon monoxide in the air
Answer:
See explaination for the code
Explanation:
def wordsOfFrequency(words, freq):
d = {}
res = []
for i in range(len(words)):
if(words[i].lower() in d):
d[words[i].lower()] = d[words[i].lower()] + 1
else:
d[words[i].lower()] = 1
for word in words:
if d[word.lower()]==freq:
res.append(word)
return res
Note:
First a dictionary is created to keep the count of the lowercase form of each word.
Then, using another for loop, each word count is matched with the freq, if it matches, the word is appended to the result list res.
Finally the res list is appended.