list_tuple.py

Python List and Tuples Projects


####################################
# Author: PUT YOUR NAME HERE
#  Date created: 18 Aug 2020
#  Date last modified: 18 Aug 2020
#  Program: list_tuple.py
# 
####################################
#Problem 1: count the number of times 2 or 3 appears in the list.
arg = [2,6,3,8,2,5,3,7,1]
result = 4
solve -1
print(result == solve)

#Problem 2  Get all of the even-indexed items out of a list
## and then get the odd-indexed entries.  Then combine them into a single
# list, even entries first.
arg = [1,2,3,4,5,6,7,8,9]
result = [1, 3, 5, 7, 9, 2, 4, 6, 8]
solve = []
print(result == solve)
#Problem 3  Find the second smallest number in a numerical list.
arg = [5,2,7,8,9,1,-1]
result = 1
solve = -1
print(result == solve)
#Problem 4  Given a numerical list with at least 4 elements, find the sum
#  of the four largest elements in the list.
arg = [1, 7, 8, 9, 10, 3, 5, 2]
solve = -1
result = 34
print(result == solve)
#Problem 5:  Given a tuple, produce a tuple with the original tuple's entries reversed.
arg = (6,5,4,3,2,1)
result = (1,2,3,4,5,6)
solve = (-1,)
print(a == result)