Module 3: Python
Fundamentals Part 2
This
week’s assignment covered importing modules, correcting script errors, creating
while loops and conditional statements, adding script comments, and iterating
variables within a loop. The script
performs a little dice rolling game based on the player’s name length, then
creates a list with 20 random numbers in it.
The script also creates a conditional statement with a nested while loop
that removes all instances of a specified number in the list.
The
script imports the random module and uses the following functions and methods:
·
Len
function.
·
Random
integer method.
·
List
append method.
·
List
count method.
·
List
remove method.
Below
is a screen shot of the results of the script.
No comments:
Post a Comment