Py29

Fri 17 April 2026
# Program 81: Count Positive
def main():
    nums = list(map(int, input("Enter numbers: ").split()))

    count = 0

    for n in nums:
        if n > 0:
            count += 1

    print("Positive count:", count)

main()
Enter numbers:  12 34 56 7


Positive count: 4
# Program 82: Count Negative
def main():
    nums = list(map(int, input("Enter numbers: ").split()))

    count = 0

    for n in nums:
        if n < 0:
            count += 1

    print("Negative count:", count)

main()
Enter numbers:  2 3 45 67


Negative count: 0
# Program 83: Duplicates
def main():
    nums = list(map(int, input("Enter numbers: ").split()))

    dup = []

    for n in nums:
        if nums.count(n) > 1 and n not in dup:
            dup.append(n)

    print("Duplicates:", dup)

main()
Enter numbers:  4 4 5 6 78


Duplicates: [4]


Score: 0

Category: misc