Why does this work this way? /u/Influence-Various Python Education

Ok, for this assignment I am supposed to give the salaries in a list a 4% raise. I created a salary list and I don’t understand why the 4% raise is being written the way that it is, so I was hoping that you could explain it to me a bit better.

Here is the code I gathered from the internet:

salarylist= [salary * 1.04 for salary in salarylist]

Can someone explain to me why it is written like this instead of a “normal” for loop?

submitted by /u/Influence-Various
[link] [comments]

​r/learnpython Ok, for this assignment I am supposed to give the salaries in a list a 4% raise. I created a salary list and I don’t understand why the 4% raise is being written the way that it is, so I was hoping that you could explain it to me a bit better. Here is the code I gathered from the internet: salarylist= [salary * 1.04 for salary in salarylist] Can someone explain to me why it is written like this instead of a “normal” for loop? submitted by /u/Influence-Various [link] [comments] 

Ok, for this assignment I am supposed to give the salaries in a list a 4% raise. I created a salary list and I don’t understand why the 4% raise is being written the way that it is, so I was hoping that you could explain it to me a bit better.

Here is the code I gathered from the internet:

salarylist= [salary * 1.04 for salary in salarylist]

Can someone explain to me why it is written like this instead of a “normal” for loop?

submitted by /u/Influence-Various
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *