Module 2: Python Fundamentals

 Module 2: Python Fundamentals

For this week, we developed string variables, using and importing modules, saving Python code as a script, including comments in scripts, creating loops and conditional statements, and iterating variables within loops to control script workflow. I had it print out my name (image and results 1), run a pass, tie, and fail test (image and results 2), and roll 10 random numbers and remove number 5 (image and results 3).

For the While/Remove statments i used the following process:

I had it create a random number between 0 and 10, then added that number to a list and upped the counter, and repeated until the list = 20, then printed the list. Next, I set the unlucky and printed the basic info with an if/else statement. If the number is there, if it is not, print some more info; if it is, count it; print more info, and remove the number

(The images are formatted horribly, but that's on Blogger)

1. 
Wagner
2.
Tom rolls a 3 out of str6 Tom gets a tie. Jane rolls a 2 out of str8 Jane loses. Phillip rolls a 14 out of str14 Phillip wins! Louis rolls a 4 out of str10 Louis loses. Julius rolls a 0 out of str12 Julius loses. Mary rolls a 2 out of str8 Mary loses. Claudia rolls a 12 out of str14 Claudia wins! Marceline rolls a 9 out of str18 Marceline gets a tie.

3. [8, 4, 1, 6, 9, 10, 0, 1, 0, 0, 0, 9, 10, 5, 3, 6, 8, 7, 0, 5] Chosen integer to remove: 5 Found 2 instance(s) of 5 to be removed. Updated List: [8, 4, 1, 6, 9, 10, 0, 1, 0, 0, 0, 9, 10, 3, 6, 8, 7, 0]





Comments

Popular posts from this blog

About Me - GIS 4006

M2 Lab: Typography