Skip to content
Advertisement

Tag: tuples

Inherit choice class to extend it?

I have a field in my models.py that accepts choices determined in a class: The choice class is this: My doubt is how can I inherit this UserChoices class to another choice class, in order to extend it with another options. I tried the following: But it gives me a migration error: Obviously this example is simplified, the actual code

How to store multiple strings in list in Python?

I have this ListOfCoordinates list with 5 tuples (image below), with each index corresponding to the coordinates of two regions of the brain. I also have this variable named brain_areas_ROIs, which is a dictionary (image below) with the names of all possible brain regions. So I want to store in a dictionary the respective brain regions for all the pairs

iterate through a tuple to form a string

I am trying to create a function named make_string, that uses * correctly with a parameter: strings The function should return a string of all the values supplied joined, and separated by a space. Outside the make_string function, I declare a variable named my_string, and assign the value returned from the make_string function. Then I call the make_string function with

Using Recursion to check for sum of tuples in a list

I have a func which takes a list of tuples, each tuple contains two items: item name and value. I need the func to return True if it’s possible to divide the tuple list into two equal valued groups and False otherwise. The function should be recursive and should not use any loops. for example, should result in True, because

Advertisement