Question

python question. Please explain this code for me.. every line. -------------------- m=[] r=[] for i in...

python question.
Please explain this code for me.. every line.
--------------------

m=[]
r=[]
for i in range(4):
    for i in range(4):
        r.append(0)
    m.append(r)
    r = [] 

0 0
Add a comment Improve this question Transcribed image text
Answer #1
# Initializing m with empty list
m=[]
# Initializing r with empty list
r=[]
# running loop variable i from 0 to 3
for i in range(4):
    # running loop variable i from 0 to 3
    for i in range(4):
        # Appending 0 to r
        r.append(0)
    # Appending r from m
    m.append(r)
    # Reinitializing r with empty list
    r = [] 

Add a comment
Know the answer?
Add Answer to:
python question. Please explain this code for me.. every line. -------------------- m=[] r=[] for i in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in python would you please help me to keep this code as in a simple and...

    in python would you please help me to keep this code as in a simple and easy code to follow please I want the code to run like first line of the letters ['B', 'C', 'D', 'BC', 'CB', 'BD', 'BCB', 'CBD', 'BCBD'] ['B', 'BC', 'BCB', 'BCBD', 'C', 'CB', 'CBD', 'BD', 'D'] word="BCBD" lst=[] for i in range(len(word)): for j in range(i+1,len(word)+1): if word [i:j] not in lst: lst.append(word[i:j]) print(lst)

  • PYTHON Im stuck, this is one line of code but I just cant remember it... Please...

    PYTHON Im stuck, this is one line of code but I just cant remember it... Please Help! Thank YOU! LIST COMPREHENSION Create a python list, that stores exactly [0,'hi', 2, thi', 4, thi', 6, 'hi', 8, thi') using python list comprehension. You can write one line of python code directly below (in the text box) or you can upload a python file having only one line of code. Write your solution (one line of python code) here. Enter your answer...

  • Code In Python Well Document Code Every Line Please * You cannot use any external Python...

    Code In Python Well Document Code Every Line Please * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work...

  • Code In Python Well Document Code Every Line Please * You cannot use any external Python...

    Code In Python Well Document Code Every Line Please * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work...

  • can some one help me explain this please? I dont understand it Python 3.6 (known limitations)...

    can some one help me explain this please? I dont understand it Python 3.6 (known limitations) 1 mashup=(2, 'abc', 1, 'def'] 2 x=mashup[1][0] 3 print(x) Edit this code xecuted

  • In Python: What is the output of the following code? for i in range(5): if i...

    In Python: What is the output of the following code? for i in range(5): if i == 2: continue print(i) Question 22 options: 0 1 2 4 0 1 3 4 0 1 3 0 1 4

  • Code In Python Well Document Code Every Line Please 5 Stars * You cannot use any...

    Code In Python Well Document Code Every Line Please 5 Stars * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program...

  • *PYTHON EXPERTS ONLY PLEASE* Please provide the answer coded in Python using comments to explain code...

    *PYTHON EXPERTS ONLY PLEASE* Please provide the answer coded in Python using comments to explain code function. Good answers will be rated with thumbs up! Please answer both parts. Thank you for your time. Question 3 - Suppose you have a file named numbers.csv which contains a bunch of integers, five per line of text, separated by commas. Write code below that will open the _le, read the numbers from it, and print the sum of all the even numbers...

  • Python I think the answer is L=[5]. Please explain Which line changes the length of list...

    Python I think the answer is L=[5]. Please explain Which line changes the length of list L? L = [] L.append(4) L[0] = len(L) L = [5] OL = [5] OL= ] L.append(4) OL[0] = len(L)

  • # Python Please help me convert the input values to float values Code works, but the...

    # Python Please help me convert the input values to float values Code works, but the values printed need to be floats like 77.0 etc.    j_list = [] k_list = [] c_list = []    # Enter scores for Jean print("Please enter Jean's scores one by one. ") for i in range(4): j_list.append(eval(input())) print("Jeans scores:", j_list)    # Enter scores for Kayla    print("Please enter Kayla's scores one by one. ") for i in range(4): k_list.append(eval(input())) print("Kayla scores: ",...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT