`df['color'] = ['red' if x == 'Z' else 'green' for x in df['Set']]`
```/*
The tax rate is often a function of the income or in other words individuals at different income levels will pay different taxes.

Also, in some countries like the UK, individuals get to keep a certain amount of their income
that's not taxed while the remainder is taxed at the applicable rate. So for example, let's say a person makes 100K and their tax rate is 10% or 0.1 but they are allowed to keep 30K. They will end up paying 7000 or 7K in taxes because:
100K - 30K = 70K. // they keep 30K and have 70K left.
10% of 70K = 7K. // they will pay 10% tax on what's left.

Your challenge is to complete the code below to return the function that will correctly calculate taxes for a person based on the rules below.

Amount                            Tax Rate
--------------------------------------------
<= 100,000                        10% or 0.1
> 100,000 to 500,000 (inclusive)  20% or 0.2
> 500,000                         35% or 0.3
*/

// Should return a function that accepts a number that's the amount to be taxed
// and returns the tax amount after factoring in the income not taxed and the
// applicable tax rate.
function getTaxCalculator(incomeNotTaxed) {
// your code here (approximately 10 lines)
function calculateTax(amount){
let taxAmount = amount - incomeNotTaxed;
if (amount <= 100000){
taxAmount * 0.1
}else if((amount>100000) && (amount<= 500000)){
taxAmount * 0.2
}else{
taxAmount * 0.3
}
}
return calculateTax
}

// THIS IS FOR YOUR TESTING ONLY.
const calculateTax = getTaxCalculator(30000)
console.log(calculateTax(100000)) // should print 70000
console.log(calculateTax(350000)) // should print 64000
console.log(calculateTax(600000)) // should print 171000```
```// This array (characters) has a length of 4 i.e characters.length is 4
// characters will return ["a", "b", "c"]
// characters will return "b"
// and so on.
const characters = [
["a", "b", "c"],
["d", "e", "f"],
["g", "h", " i"],
["x", "y", "z"],
];

function characterExist(letter) {
// we initialize exists to false because we intend to set it to true only if /// we find the letter in the colors array
let exist = false;

// TODO(1): Write code to loop through the characters array, and set exist to
// true if the value in the variable letter is found in the array.
for(i=0; i<=characters.length; i++){
for(j=0; j<=characters[i].length; j++){
if(characters[i][j] === letter){
exist = true;
return true
}
}
}
return exist;
}

// THIS IS FOR TESTING ONLY
console.log("a exists = " +  characterExist("a")); // prints true
console.log("p exists = " +  characterExist("p")); // prints false```
``` #declare two set the range
1.i = 1
2.j = 5
#use while loop for i
3.while i < 4:
#use while loop for j
4.while j < 8:
5.print(i, ",", j)
6.j = j + 1
7.i = i + 1
Output:
1 , 5
2 , 6
3 , 7
```
star

Wed Jun 30 2021 07:05:52 GMT+0000 (UTC)

#python #comprehension #loop
star

Fri Jun 25 2021 15:12:00 GMT+0000 (UTC) edconnect.com

#loop
star

Wed Jun 23 2021 13:58:24 GMT+0000 (UTC) edconnect.com

#2-darrays #loop
star

Tue Apr 21 2020 06:12:11 GMT+0000 (UTC) https://beginnersbook.com/2018/01/python-while-loop/

#python #python #loop #whileloop #nestedwhile loop

#### Save snippets that work with our extensions   