Share your repls and programming experiences

← Back to all posts
7.4. Lists: Same sign neighbors
pole55

Given a list of non-zero integers, find and print the first adjacent pair of elements that have the same sign. If there is no such pair, print 0.

Example input #1
-1 2 3 -1 -2

Example output #1
2 3

Example input #2
1 -3 4 -2 1

Example output #2
0

Voters
GeorgeNi
PatadiaKeval
TienDungDung1
MM11MD
KieraYoung
a41689Matilde
yanachernova
Pikachu12
XinranCui
pole55