diff --git a/day-04/lists_example.py b/day-04/lists_example.py index b3d3e91..396a0ce 100644 --- a/day-04/lists_example.py +++ b/day-04/lists_example.py @@ -1,2 +1,9 @@ -states = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", "Massachusetts", "Maryland", "South Carolina", "New Hampshire", "Virginia", "New York", "North Corolina", "Rhode Island"] +states = ["Delaware", "Pennsylvania", "New Jersey", "Georgia", "Connecticut", + "Massachusetts", "Maryland", "South Carolina", "New Hampshire", + "Virginia", "New York", "North Corolina", "Rhode Island"] +print(states[0]) +print(states[-1]) + +list.append("Illinois") +list.extend("Tennessee, Kentucky") diff --git a/day-04/pirate_treasure.py b/day-04/pirate_treasure.py new file mode 100644 index 0000000..dc17543 --- /dev/null +++ b/day-04/pirate_treasure.py @@ -0,0 +1,15 @@ +import string + +line1 = [" ", " ", " "] +line2 = [" ", " ", " "] +line3 = [" ", " ", " "] +map = [line1, line2, line3] +print("Hiding your treasure! X marks the spot.") +position = input() # Where do you want to put your treasure + +col = position[0] +row = position[1] + +map[string.ascii_lowercase.index(col)][int(row)-1] = 'X' + +print(f"{line1}\n{line2}\n{line3}") \ No newline at end of file diff --git a/day-04/random_name.py b/day-04/random_name.py new file mode 100644 index 0000000..9d739a3 --- /dev/null +++ b/day-04/random_name.py @@ -0,0 +1,7 @@ +import random + +names_string = "Angela, Ben, Jerry, Michael, Chloe" +names = names_string.split(", ") + +random_name = random.randint(1, len(names)-1) +print(names[random_name]) \ No newline at end of file