Flowchart Working with Spyder was a challenge. I had started on step 1 on a different approach than the lab instructions gave. My First Attempt started as follows stringName = “Brittany Anne Joe” nameList – (“Brittany” “Anne” “Joe”) print (“Joe”) Although this gave the same results of printing my last name Joe in the program I learned to use some of Python’s functions that allows me to print my last name from a list. stringName.split automatically takes your stringName feature and divide it into separate cars for “Brittany” “Anne” “Joe”. To specify what to print from a list you need to index by specifying the number that represents your list. So “Brittany” would be 0, “Anne “would be 1, and “Joe” was 2. After step 1, we had to debug a prewritten code that generates the results of random wins and losses for the players. I was challenged to create a loop to generate 20 random numbers between 0-10. My unlucky value was number 5 and we had to use an if/else st...
Comments
Post a Comment