0% found this document useful (0 votes)
2 views1 page

Data Processing Function in Python

Uploaded by

thirdeyeforexsl
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Data Processing Function in Python

Uploaded by

thirdeyeforexsl
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

def process_data(data):

for i in range(len(data)):
if data[i] < 0:
data[i] = 0
elif data[i] == 0:
data[i] = 1
else:
data[i] *= 2
for i in range(len(data)):
if data[i] % 2 == 0:
data[i] = data[i] // 2
else:
data[i] = data[i] * 3 + 1
return data

data = [1, -2, 3, 0, 5]


result = process_data(data)
print(result)

You might also like