Alright, I am new to Python and am learning about tuples and lists. I have been asked to create a program, however that involves converting the following list:      li = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]   in to a list which looks like this:      li = [[(1,2,3),(4,5,6)],[(7,8,9),(10,11,12)],[(13,14,15),(16,17,18)]   Basically, from a simple list to a list containing a sublist which contains two tuples which contain 3 elements.  I appreciate your help.  Thanks.
I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:
For what values $s$ does $\int_{0}^{\infty} \frac{\sin x}{x^s}dx$ converge? For what values $s$ does $\int_{0}^{\infty} \frac{\sin x}{x^s}dx$ converge?  Solution says $0&lt;s&lt;2$.  Any ideas? Quantum information references Why 32bits OSs can't address more than 3.2/3.2 gb of memory? Don't know if this is the right place to ask this question.  I've been reading that 32bit OSs (like the Ubuntu i'm running right now) can't adress more than 3.2gb or 3.3gb of RAM memory.  I remember for my old Computer Architecture course that the memory limitation was 2^32 "pointers" (don't remember the right word). I mean, the memory was represented like an array where the CPU can acces it directly, but up to its limit. If the CPU is 32 bit, then it can address 2^32 words, if it's 64 bits 2^64, etc.  So, if what i said before is right, then, my OS should be able to address 2^32 = 4294967296 = 4Gb.  I'm thinking maybe some sort of space is reserved to the particular use of the Kernel, cache, buffering or swapping. But don't have the correct answer.  Can you give me a hint? Auto Increment Problem in Mysql Prefer composition over inheritance? How to capture a series of screenshots in Web Driver using Java If I open files I created in Windows, the lines all end with ^M. How do I delete these characters all at once? PCA: Eigenvectors of opposite sign and not being able to compute eigenvectors with `solve` in R Get on what tile has mouse clicked GCD in a PID persists in extension domains Let $R$ be subring of integral domain $S.$ Suppose $R$ is $\text{PID}.$ Let $a\in R$ be a greatest common divisor of $r_1,r_2$ in $R$. ($r_1,r_2 \in R$, not both zero). Could anyone advise me on how to prove $a$ is greatest common divisor of $r_1,r_2$ in $S?$   Hints will suffice, thank you. How can I get a shapefile from a postgis query? My data is in a PostGIS database. I would like to generate a shapefile from a query. How can I do that? I'm unable to get Atom text editor from the Software Center. When I try I get this error:  Package does not exist. Check the spelling of the package name, and that the appropriate repository is enabled. Nautilus does not show the left bar, how do I turn it back on? When I open nautilus does not open the left bar where it says computer and down markers such as music, documents, videos, downloads. I reinstalled nautilus from the synaptic package manager but nothing happened. What I can do to make that bar visible again? Prove the following in $S_n$:  Let $\alpha = (a_1,a_2,\ldots,a_s)$ be a cycle and let $\pi$ be a permutation in $S_n$. Then $\pi\alpha\pi^{-1}$ is the cycle $(\pi(a_1),\ldots,\pi(a_s)).$     I'm not sure where to even start. How do I get lightning:datatable to do some undocumented thing X? Installing particular versions when repo has newer versions? After some searching on stack / google I decided to ask this here, this is the second time I'm facing this issue this time with blender 2.8, previously with 2.7 and without a clue to how I got here.  Some of my objects appear hidden(10/12), and I can't seem to find a way to unhide them.  Solutions to the most common rookie mistakes seems to be   In local-view solved by pressing numpad / hidden by pressing H or Shift + H, unhiding with Alt + H   I'm not in local view, I can toggle visibility for 2/12 objects with Shift + H &amp; Alt + H, but the rest stays gray in the collection.  Last time I solved this by exporting the whole model as STL and importing it back again, I then had to re-group all the pieces but there must be a more simple solution.  Here's the .blend if someone wants to have a go at it: Query a region within a larger region with GeoDjango REST API I have a working Django REST API which can query all the counties in a country. //My model class kenya_counties(models.Model):   objectid = models.BigIntegerField()   id_field = models.BigIntegerField()   county_nam = models.CharField(max_length=80)   const_code = models.BigIntegerField()   constituen = models.CharField(max_length=80)   county_cod = models.BigIntegerField()   shape_leng = models.FloatField()   shape_area = models.FloatField()   geom = models.MultiPolygonField(srid=4326)    def __str__(self):       return self.county_nam  //My Serializer class CountiesSerializer(serializers.ModelSerializer):   class Meta:      model = kenya_counties      fields = ('objectid', 'id_field', 'county_nam', 'const_code', 'constituen', 'county_nam', 'county_cod', 'shape_leng', 'shape_area')  //My view @api_view(['GET', 'POST']) def counties(request):    if request.method == 'GET':        data = kenya_counties.objects.all()         serializer = CountiesSerializer(data, context={'request': request}, many=True)         return Response(serializer.data)     elif request.method == 'POST':        serializer = CountiesSerializer(data=request.data)        if serializer.is_valid():            serializer.save()            return Response(status=status.HTTP_201_CREATED)                 return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)  //My url     re_path(r'^api/gis/counties/$', views.counties),  I get . How can I query just one county and display it on a react-leaflet map as shown below? &lt;MapContainer center={position} zoom={13} scrollWheelZoom={false}&gt;     &lt;TileLayer       attribution='&amp;copy; &lt;a href=&quot;http://osm.org/copyright&quot;&gt;OpenStreetMap&lt;/a&gt; contributors'       url=&quot;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&quot;     /&gt; &lt;/MapContainer&gt; A club has $12$ members. They need to choose a programming team of $3$ members and a hacking team of $4$ members. Members can be on both teams, but Jack only wants to be on at most one team. How many ways can both teams be chosen?  I did two different ways. I solved if Jack chooses programming, $C(12,3)=220$ $C(11,4)=330$. In total there are $550$ different ways both teams can be picked.  But, if Jack chooses hacking, I solved $C(11,3)=165$ and $C(12,4)=495$. In total there are $650$ ways both teams can be chosen.  I was wondering if this is the correct method. As a new user without much rep, what should I do if someone else has already asked a question I have, but it has no answers?