import math
import argparse

"""
Problem 1:
Write a function called count_uppercase_letters. The function will take one argument which will be a string. 
It will return the number of uppercase letters in a string. 
"""
def count_uppercase_letters(my_string):
    count = 0
    for letter in my_string:
        if letter.istitle():  
            count += 1
    return count

"""
Problem 2:
Write a function called interleave_lists. This function will two take arguments, 
both lists. It will interleave the items in the list (see the example below). 
The function signature will be interleave_lists(list_1, list_2).
list_1 = [1, 2, 3, 4]
List_2 = ['a', 'b', 'c', 'd']
result should be [1, 'a', 2, 'b', 3, 'c', 4, 'd']
"""
def interleave_lists(list_1, list_2):
    result = []
    # Find the length of the shorter list
    smaller_length = min(len(list_1), len(list_2))

    # Interleave up to the length of the shorter list
    for i in range(smaller_length):
        result.append(list_1[i])
        result.append(list_2[i])

    # If there are extra elements in list_1
    for i in range(smaller_length, len(list_1)):
        result.append(list_1[i])

    # If there are extra elements in list_2
    for i in range(smaller_length, len(list_2)):
        result.append(list_2[i])

    return result

"""
Problem 3:
Write a function called cylinder_stats. This function will take in two arguments, the radius and the height of a cylinder (specifically a "solid right circular cylinder"). It will return two results, the area and the volume of the cylinder. The function signature will be cylinder_stats(radius, height).
The formulas for the surface area and the volume of a cylinder are:
Surface Area = 2πr(h + r)
Volume = π(r2)h
"""
def cylinder_stats(radius, height):   
    # Surface Area (SA) = 2πr(r + h)
    surface_area = 2 * math.pi * radius * (radius + height)
    
    # Volume (V) = πr^2h
    volume = math.pi * (radius ** 2) * height
    
    return surface_area, volume

"""
Problem 4:
Write a simple python script that uses argparse to accept two positional arguments 
from the command line. The script can simply print the arguments; 
you will just be graded on the correct use of argparse.
"""

def main():
    parser = argparse.ArgumentParser(description='Accept two positional arguments')
    parser.add_argument('arg1', help='first argument')
    parser.add_argument('arg2', help='second argument')
    
    args = parser.parse_args()
    print(f"First argument: {args.arg1}")
    print(f"Second argument: {args.arg2}")

if __name__ == "__main__":
    main()
