Skip to content

Tag: python

How do you change a string that is already in the console?

I’m trying to make a typing thingy where you type what time delay you would like and what the string you want to output is and then it slowly types each letter: I just have one problem. I want the string to output in one line but each letter at a different time, but I can only make it so

Access a deeply nested dictionary and multiply values

I have this nested dictionary: I need to access the ‘w’ values and make them multiply by 3. What I’ve tried is: It doesn’t work, and I’ve tried other ways and it doesn’t work as well. Any tips? EDIT: Wrong dictionary, edited it Answer You could use a recursive function that…

Generating Scatter Plot from a Matrix

I have a code that generates random matrices of 0’s and 1’s, and I’d like to convert these matrices into scatter plots, where the coordinate corresponds to the matrix row/column, and the color of the scatter point corresponds to the value (red if 0, blue if 1 for example). I’ve been ab…

Counting repeated pairs in a list

I have an assignment that has a data mining element. I need to find which authors collaborate the most across several publication webpages. I’ve scraped the webpages and compiled the author text into a list. My current output looks like this: etc for ~100 more rows. My idea is, for in each section of th…