vendredi 26 mars 2021

How to set different (if) parameters for the same number in a list?

  • I don't even know how to format this paragraph right haha

Hi there I'm completely new to Python. I was wondering if I have a list how do I take the output of a first if command and use on the next

Example L= [23, 91, 0, -11, 4, 23, 49]

for i in L:

if(i > 10):

print(i * 30) example

I also want to check if the output of this number is an even number if so (+6) -- for the output of that if number is not equal to -11 I want to add 10.

So I got 23 > 10= (23*30 = 690) // 690 is an even number ( 690 + 6=696) // it not equal to -11 so (696+10= 706).

How do I do this for every number on the list? Excuse my lack of knowledge it's literally my first python class and my first exercises.

Aucun commentaire:

Enregistrer un commentaire