Skip to content

Tag: loops

Name ‘ ‘ is not defined – python

from bunch of files I want to extract some info (code is below), but I came across error: “name ‘GH_Pos21X_true’ is not defined”, full error: Where should I defined it? Code: I can’t see a problem, maybe someone could help me find my mistake? I will be grateful. If I don’t set this variable as global I have this error:

Looping through HTML & following links

I am writing a code that is supposed to open a url, identify the 3rd link and repeat this process 3 times (each time with the new url). I wrote a loop (below), but it seems to each time sart over with the original url. Can someone help me fix my code? Answer You need to define the empty list

Increasing performance for search pandas df, Count occurrences of starting string grouped by unique identifier

Current dataframe is as follows: Expected Output: Question: How do I get the counts of the ‘starting string’, only when uniqueID is occurring for the first time with increased performance. Thus far, I’m doing with a simple for loop of the data and checking with if/else statements. But this is incredibly slow with a large dataframe. I’m curious if there

While/For/If Else Loop after checking user input

I’m new to Python and learning. I’m trying to write a program to: User input full name (with space) Check duplication to a list (I used split and join to compare strings) If find a duplication, re-input new name If not, simply break the loop and print “Thanks” I only need to print “Duplicated” or “Thanks” 1 time, not multiple

Python Loops result not understanding [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 months ago. Improve this question Can anyone please help explain what the hell is going on with this