Skip to content
Advertisement

Tag: loops

Function with two loops

I want to make a function what must have 2 loops: must check that at least 2 characters (letters) are inserted if the two characters are in the form that the variable must receive at the end, the variable receives the correct orthographic form. Here is my code (but it throws me in infinite loop) [Please be indulgent im a

Python – Reset Increment

I have a list of values in a column (A) and want to increment by 1 in column (B) until the value in A changes, however, having difficulty in my loop to reset the increment when A changes. Here is desired output: Product(A) No.(B) Apple 1 Apple 2 Apple 3 Orange 1 Orange 2 Orange 3 Orange 4 Orange 5

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 6 months ago. Improve this question Can anyone please help explain what the hell is going on with this

multiple for in python query loop and save them

need to save them into different data frames the expected result is running these batches for each class individually. e.g df_class1, df_class2 df_class3, df_class4 each results as sth like ;df_class1, df_class2 df_class3, df_class4 Answer You can use formatted string to save the resultant dataframe for each iteration.

Python re-setting the for loop if an element is deleted in an iteration

The above code is an idea to explain the task what Iam performing. I have a list that Iam looping through when it finds something or meet some condition it will delete that specific index element accordingly. For instance if it finds element ‘c’ in the list then it will delete it from the list but it throws an IndexError:

Advertisement