Category : loops

Beginner question: I am trying to iterate over the lists and return each item to send to another list. I can only get it to return the last item in each list- 4 & ‘home’. What am I doing wrong? def help(): alist = [1, 2, 3, 4] blist = [‘bob’, ‘is’,’not’, ‘home’] for event ..

Read more

I don’t understand what am I doing wrong here, I’m a new programmer. I want to download all these links file, but in the end I’m only getting in Download one last link file fo14NOV2020bhav.csv.zip. My Code – headers = {‘Referer’:’https://www1.nseindia.com’} def download_url(url, save_path, chunk_size=128): r = requests.get(url, stream=True,headers=headers) with open(save_path, ‘wb’) as fd: for ..

Read more

I am trying to evaluate an integral using the trapezoidal rule for a range of n = 2^p where p= [1,2…20], to produce different values for the integral. I have tried to implement a for loop to define n and h however I get a TypeError:’list’ object cannot be interpreted as an integer. Is there ..

Read more