Dice and Date Mod 2

 This week’s lab focused on working with loops and lists in Python. I started by splitting my full name into a list and printing just my last name using indexing. Then I went through a prewritten for loop that simulated a dice game and made sure everything ran correctly, fixing a couple issues in the process.


Next, I created a list of 20 random numbers between 0 and 10 using a while loop. After the list was done, I chose the number 6 and wrote code to remove it from the list completely. I used an if-else statement to check if 6 was even in the list, and if it was, I used the count method to see how many times it showed up, then removed it using a while loop and the remove method.


Here’s a screenshot of my output showing the list before and after removing 6, along with the dice game results.





Once everything was working, I saved a screenshot of my results and added both the screenshot and my process summary to the Results folder. I also added a row in the data chart to keep track of those files. This lab helped me get more comfortable using loops and list methods, and it showed me how useful conditionals can be when handling different outcomes in your code.

Comments