Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # define a 2D list of characters that represents a smiley face
- smiley = [[" "," "," "," "," "," "," "," "," "," "," "," "],
- [" "," "," ","*"," "," "," "," ","*"," "," "," "],
- [" "," ","*","*","*"," "," ","*","*","*"," "," "],
- [" "," ","*","*","*"," "," ","*","*","*"," "," "],
- [" "," "," ","*"," "," "," "," ","*"," "," "," "],
- [" "," "," "," "," "," "," "," "," "," "," "," "],
- ["*","*"," "," "," "," "," "," "," "," ","*","*"],
- [" ","*","*"," "," "," "," "," "," ","*","*"," "],
- [" "," ","*","*","*","*","*","*","*","*"," "," "],
- [" "," "," ","*","*","*","*","*","*"," "," "," "]]
- # find the total number of rows
- total_rows = len(smiley)
- # repeat the outer loop based on the total number of rows
- for row in range(total_rows): # <----- Here is missing the argument of range (total_rows).
- # find the number of values in the current row
- total_cols = len(smiley[row])
- # repeat the inner loop based on the total number of cols
- for col in range(total_cols): # <----- Here is missing the 'for' inner loop to col (col, total_cols).
- # output the value from the current row and column
- # setting end to an empty string stops a new line from being created
- print(smiley[row][col], end=" ") # <----- Here is missing the arguments of array 2D smile (row , col)
- # output a new line after each row has ended
- print("\n")
Add Comment
Please, Sign In to add comment