Du er ikke logget inn. Så lenge du ikke er logget inn går du glipp av muligheten for å holde styr på din egen progresjon.

Logg inn

Valgte tags:

Filtrering:

Skriv ut:

Test

The goal of this exercise is practice syntax of for loops, if tests and functions

a)
Reorganise the code and indent the lines where necessary so that it becomes a function that counts the number of positive and negative numbers from the list. Note that the functions returns two variables

else:
for v in values:
if v > 0:
def neg_pos_counts(values):
negative += 1
negative = 0
positive += 1
positive = 0
return negative, positive