Re: [Tutor] Proxy for Python?
On Wed, Feb 06, 2019 at 02:03:01PM +, beech 48 wrote: > Hi i am totally new to this, i am not a coder and am lost. We are coders and we are still lost, because we can't read your mind and we have no idea what you are talking about. Instagram? How is that relevant? You say you are entering a proxy, but *where* are you entering it and what are you doing with it? -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] learning python from scratch
dear fellow programmeers, this is michael. I have a question for Python. I'm a beginner Pythonist. I havee been learning the history and it's use for past years. My main focus this year is to learn it's code and begin coding. Where can I find resource for this? All comment are greatly appreciate it Best regards Michael Munn Michael Munn Member: Virginia Association of Blind students National Federation of the Blind of Virginia www.nfbv.org Member: Maryland Association of Blind Students National Federation of the Blind of Maryland www.nfbmd.org Students of: Hadley Institute of the Blind www.hadley.edu ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] text processing lines variable content
On 06/02/2019 21:45, Mark Lawrence wrote: So what, you still don't need to chop the front from the list, just process the data. just slice I'd like to adapt the order in that the functions are applied, but how? I suspect that you're trying to over complicate things, what's wrong with a simple if/elif chain, a switch based on a dict or similar? You mean create a list with the order=[a,b,e,d...] Again I've no idea what you're saying here. depending on how the input file is created data packet a can be in an other position for every line. figured out how to do it though order=[a,b,e,d...] for i in lines: i=i.split(" ") for j in order: if j = a: use function for processing data chunk a elseif j = b: use proper function for processing data type b ... I don't know beforehand how many lines I have. Now you tell us :-( sorry then loop order=[a,b,e,d...] for each line What has a loop order got to do with using a dict? order of data chunks varies per file Why bother, just have a list of lists and index on the position, or are we talking at cross purposes? Sorry for the amount of text below, I hope it clarifies one line of space delimited input data: 0 1094.82 0.1 582.419 0.5 14 (0.200231,1.13714,-8.35338) (-10.2097,1.13714,-4.05001) (-10.2097,-14.3466,-4.05001) (-2.4419,-39.895,9.65513) (-0.382375,-100.1,7.27361) (0.200231,-100.1,-8.35338) (-2.43137,1.58294,9.64296) (-10.1818,1.514,-4.00085) (-2.4419,1.51399,9.65513) (3.73705,-100.1,2.51013) (0.220825,1.58294,-8.29013) (-6.42082,-100.1,-5.61629) (-10.1626,1.58294,-3.9977) (3.73705,1.58294,2.51013) (1095.02,1.23714,574.066) (1084.61,1.23714,578.369) (1084.61,-14.2466,578.369) (1092.38,-39.795,592.074) (1094.44,-100,589.693) (1095.02,-100,574.066) (1092.39,1.68294,592.062) (1084.64,1.614,578.418) (1092.38,1.61399,592.074) (1098.56,-100,584.929) (1095.04,1.68294,574.129) (1088.4,-100,576.803) (1084.66,1.68294,578.421) (1098.56,1.68294,584.929) 3 3 3 3 3 3 3 3 3 3 3 3 3 3 10092.8 21 550.726 9 23.4034 221.001 102.986 190.388 219.178 39.1211 226.154 47.7032 31.5186 4765.01 5 5 5 4 6 4 5 4 4 0 0 0 0 4 4 1 5.07336 964.581 451.085 1100.75 865.736 81.7357 1161.69 133.262 1.10745 (1,0,10,12,7) (1,2,11,5,0) (1,7,8,3,2) (2,3,4,11) (3,8,6,13,9,4) (4,9,5,11) (5,9,13,10,0) (6,12,10,13) (6,8,7,12) (-0.377877,0.147157,-0.914086) (-0.382036,2.8913e-18,-0.924147) (-0.869981,0,0.493086) (-0.904528,-0.0477043,0.423738) (0.75639,-5.72053e-15,0.654121) (-0,-1,0) (0.950875,4.0561e-18,-0.309575) (-5.99268e-17,1,-1.44963e-16) (-0.849681,0.21476,0.481581) 9205 9105 3062 9946 5786 -3 1483 100 3262 11680.5 -2.00777 -44.9048 -0.428504 1092.81 -44.8048 581.99 this one line as it is in the output file. For a file with 10 lines the outer arrays will be 10 items long: #declare Labels = array[0]{0} #declare Points = array[0]{<1094.82,0.1,582.419>} #declare Radii = array[0]{0.5} #declare NumVertices = array[0]{14} #declare RelVertices = array[0]{ //label: 0 array[14]{ <0.200231,1.13714,-8.35338>,<-10.2097,1.13714,-4.05001>,<-10.2097,-14.3466,-4.05001>,<-2.4419,-39.895,9.65513>,<-0.382375,-100.1,7.27361>,<0.200231,-100.1,-8.35338>,<-2.43137,1.58294,9.64296>,<-10.1818,1.514,-4.00085>,<-2.4419,1.51399,9.65513>,<3.73705,-100.1,2.51013>,<0.220825,1.58294,-8.29013>,<-6.42082,-100.1,-5.61629>,<-10.1626,1.58294,-3.9977>,<3.73705,1.58294,2.51013> } } #declare GlobalVertices = array[0]{ //label: 0 array[14]{ <1095.02,1.23714,574.066>,<1084.61,1.23714,578.369>,<1084.61,-14.2466,578.369>,<1092.38,-39.795,592.074>,<1094.44,-100,589.693>,<1095.02,-100,574.066>,<1092.39,1.68294,592.062>,<1084.64,1.614,578.418>,<1092.38,1.61399,592.074>,<1098.56,-100,584.929>,<1095.04,1.68294,574.129>,<1088.4,-100,576.803>,<1084.66,1.68294,578.421>,<1098.56,1.68294,584.929> } } #declare MaxRadius = array[0]{10092.8} #declare NumEdges = array[0]{21} #declare EdgeDistance = array[0]{550.726} #declare NumFaces = array[0]{9} #declare FacePerimeter = array[0]{ //label: 0 array[9]{23.4034,221.001,102.986,190.388,219.178,39.1211,226.154,47.7032,31.5186} } #declare SurfaceArea = array[0]{4765.01} #declare FacesOrders = array[0]{ //label: 0 array[9]{5,5,5,4,6,4,5,4,4} } #declare FreqFaces = array[0]{ //label: 0 array[7]{0,0,0,0,4,4,1} } #declare FaceArea = array[0]{ //label: 0 array[9]{5.07336,964.581,451.085,1100.75,865.736,81.7357,1161.69,133.262,1.10745} } #declare FaceVerticesIndex = array[0]{ //label: 0 array[9]{ array[5]{1,0,10,12,7}, array[5]{1,2,11,5,0}, array[5]{1,7,8,3,2}, array[4]{2,3,4,11}, array[6]{3,8,6,13,9,4}, array[4]{4,9,5,11}, array[5]{5,9,13,10,0}, array[4]{6,12,10,13}, array[4]{6,8,7,12}, } } #declare FaceNormal = array[0]{ //label: 0 array[9]{ <-0.377877,0.147157,-0.914086>,<-0.382036,2.8913e-18,-0.924147>,<-0.869981,0,0.493086>,<-0.904528,-0.0477043,0.423738>,<0.75639,-5.72053e-15,0.654121>,<-0,-1,0>,<0.950875,4.0561e-18,-0.30957
Re: [Tutor] text processing lines variable content
On 06/02/2019 18:51, ingo janssen wrote: On 06/02/2019 19:07, Mark Lawrence wrote: That's going to a lot of work slicing and dicing the input lists. Perhaps a chunked recipe like this https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked would be better. The length of the text chunks varies from a single character to a list of ~30 3D vectors. So what, you still don't need to chop the front from the list, just process the data. I'd like to adapt the order in that the functions are applied, but how? I suspect that you're trying to over complicate things, what's wrong with a simple if/elif chain, a switch based on a dict or similar? You mean create a list with the order=[a,b,e,d...] if a in order: f_vector_array(a, 3) elseif b in order: f_value(max_radius) that would run the proper function, but not in the right order? Again I've no idea what you're saying here. for i, line in enumerate(open("vorodat.vol",'r')): points = i+1 enumerate takes a start argument so you shouldn't need the above line. points is needed later on in the program and I don't know beforehand how many lines I have. Now you tell us :-( I thought about putting the functions in a dict and then create a list with the proper order, but can't get it to work. Please show us your code and exactly why it didn't work. def f_vector_array(outlist, length): rv = pop_left_slice(line, length) rv = [f'<{i[1:-1]}>' for i in rv] #i format is: '(1.234,2.345,3.456)' rv = ",".join(rv) outlist.append(f" //label: {lbl}\n array[{length}]"+"{\n "+rv+"\n }\n") functions={ 'a':f_number(num_vertex), 'b':f_vector_array(rel_vertex,v) } where rel_vertex is the list where to move the processed data to and v the amount of text to chop of the front of the line. v is not known when defining the dictionary. v comes from an other function v=f_number(num_vertex) that also should live in the dict. You don't need to specify the parameters in the dict, just give the function name. then loop order=[a,b,e,d...] for each line What has a loop order got to do with using a dict? I'm not absolutely sure what you're saying here, but would something like the SortedList from http://www.grantjenks.com/docs/sortedcontainers/ help? Maybe this explains it better, assume the split input lines: line1=[a,b,c,d,e,f,...] line2=[a,b,c,d,e,f,...] line3=[a,b,c,d,e,f,...] ... line10=... all data on position a should go to list a a=[a1,a2,a3,...a_n] b=[b1,b2,b3,...b_n] c=[c1,c2,c3,...n_n] etc. this is what for example the function f_vector_array(a, 3) does. Why bother, just have a list of lists and index on the position, or are we talking at cross purposes? All these lists have to be written to a single file, each list contains 10 items. Instead of keeping it all in memory I could write a1 to a temp file A instead of putting it in a list first and b1 to a temp file B etc. in the next loop a2 to file A, b2 to file B etc. When all lines are processed combine the files A,B,C ... to a single file. Or is there a more practical way? Speed is not important. What is your definition of "combine the files A,B,C ... to a single file"? ingo -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] text processing lines variable content
On 06/02/2019 19:07, Mark Lawrence wrote: That's going to a lot of work slicing and dicing the input lists. Perhaps a chunked recipe like this https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked would be better. The length of the text chunks varies from a single character to a list of ~30 3D vectors. I'd like to adapt the order in that the functions are applied, but how? I suspect that you're trying to over complicate things, what's wrong with a simple if/elif chain, a switch based on a dict or similar? You mean create a list with the order=[a,b,e,d...] if a in order: f_vector_array(a, 3) elseif b in order: f_value(max_radius) that would run the proper function, but not in the right order? for i, line in enumerate(open("vorodat.vol",'r')): points = i+1 enumerate takes a start argument so you shouldn't need the above line. points is needed later on in the program and I don't know beforehand how many lines I have. I thought about putting the functions in a dict and then create a list with the proper order, but can't get it to work. Please show us your code and exactly why it didn't work. def f_vector_array(outlist, length): rv = pop_left_slice(line, length) rv = [f'<{i[1:-1]}>' for i in rv] #i format is: '(1.234,2.345,3.456)' rv = ",".join(rv) outlist.append(f" //label: {lbl}\n array[{length}]"+"{\n "+rv+"\n }\n") functions={ 'a':f_number(num_vertex), 'b':f_vector_array(rel_vertex,v) } where rel_vertex is the list where to move the processed data to and v the amount of text to chop of the front of the line. v is not known when defining the dictionary. v comes from an other function v=f_number(num_vertex) that also should live in the dict. then loop order=[a,b,e,d...] for each line I'm not absolutely sure what you're saying here, but would something like the SortedList from http://www.grantjenks.com/docs/sortedcontainers/ help? Maybe this explains it better, assume the split input lines: line1=[a,b,c,d,e,f,...] line2=[a,b,c,d,e,f,...] line3=[a,b,c,d,e,f,...] ... line10=... all data on position a should go to list a a=[a1,a2,a3,...a_n] b=[b1,b2,b3,...b_n] c=[c1,c2,c3,...n_n] etc. this is what for example the function f_vector_array(a, 3) does. All these lists have to be written to a single file, each list contains 10 items. Instead of keeping it all in memory I could write a1 to a temp file A instead of putting it in a list first and b1 to a temp file B etc. in the next loop a2 to file A, b2 to file B etc. When all lines are processed combine the files A,B,C ... to a single file. Or is there a more practical way? Speed is not important. ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] text processing lines variable content
On 06/02/2019 16:33, ingo janssen wrote: For parsing the out put of the Voro++ program and writing the data to a POV-Ray include file I created a bunch of functions. def pop_left_slice(inputlist, length): outputlist = inputlist[0:length] del inputlist[:length] return outputlist That's going to a lot of work slicing and dicing the input lists. Perhaps a chunked recipe like this https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked would be better. this is used by every function to chop of the required part of the input line. Two examples of the functions that proces a chopped of slice of the line and append the data to the approriate list. def f_vector(outlist): x,y,z = pop_left_slice(line,3) outlist.append(f"<{x},{y},{z}>,") def f_vector_array(outlist, length): rv = pop_left_slice(line, length) rv = [f'<{i[1:-1]}>' for i in rv] #i format is: '(1.234,2.345,3.456)' rv = ",".join(rv) outlist.append(f" //label: {lbl}\n array[{length}]"+"{\n "+rv+"\n }\n") Every line can contain up to 21 data chunks. Within one file each line contains the same amount of chunks, but it varies between files. The types of chunks vary and their position varies. I know beforehand how a line in a file is constructed. I'd like to adapt the order in that the functions are applied, but how? I suspect that you're trying to over complicate things, what's wrong with a simple if/elif chain, a switch based on a dict or similar? for i, line in enumerate(open("vorodat.vol",'r')): points = i+1 enumerate takes a start argument so you shouldn't need the above line. line = line.strip() line = line.split(" ") lbl = f_label(label) f_vector(point) Presumably the above is points? f_value(radius) v=f_number(num_vertex) f_vector_array(rel_vertex,v) f_vector_array(glob_vertex,v) f_value_array(vertex_orders,v) f_value(max_radius) e=f_number(num_edge) f_value(edge_dist) ...etc I thought about putting the functions in a dict and then create a list with the proper order, but can't get it to work. Please show us your code and exactly why it didn't work. A second question, all this works for small files with hundreds of lines, but some have 10. Then I can get at max 22 lists with 10 items. Not fun. I tried writing the data to a file "out of sequence", not fun either. What would be the way to do this? I thought about writing each data chunk to a proper temporary file instead of putting it in a list first. This would require at max 22 temp files and then a merge of the files into one. I'm not absolutely sure what you're saying here, but would something like the SortedList from http://www.grantjenks.com/docs/sortedcontainers/ help? TIA, ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Proxy for Python?
Hi i am totally new to this, i am not a coder and am lost. I have python working on just 1 of my instagram account right now and its working great but i have no proxy in and im afraid i will get kicked off from IG and i cannot loose this account. i am having the hardest time trying to put my newly purchased Proxy from Highproxies.com into the code. I have tried so many combos and it fails everytime i try loading. This is what i am entering proxy="http://183.172.92.206:22313";, All i was given from them was an option to use my proxy is the two choices of User & Password Authentication or IP Authentication Right now i have it on IP Authentication by imputing my actual IP address in one of there 3 IP fields and hit setup to activate. But nothing works. I have asked them but they have no idea. Can anyone please help me? Thank you ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] text processing lines variable content
For parsing the out put of the Voro++ program and writing the data to a POV-Ray include file I created a bunch of functions. def pop_left_slice(inputlist, length): outputlist = inputlist[0:length] del inputlist[:length] return outputlist this is used by every function to chop of the required part of the input line. Two examples of the functions that proces a chopped of slice of the line and append the data to the approriate list. def f_vector(outlist): x,y,z = pop_left_slice(line,3) outlist.append(f"<{x},{y},{z}>,") def f_vector_array(outlist, length): rv = pop_left_slice(line, length) rv = [f'<{i[1:-1]}>' for i in rv] #i format is: '(1.234,2.345,3.456)' rv = ",".join(rv) outlist.append(f" //label: {lbl}\n array[{length}]"+"{\n "+rv+"\n }\n") Every line can contain up to 21 data chunks. Within one file each line contains the same amount of chunks, but it varies between files. The types of chunks vary and their position varies. I know beforehand how a line in a file is constructed. I'd like to adapt the order in that the functions are applied, but how? for i, line in enumerate(open("vorodat.vol",'r')): points = i+1 line = line.strip() line = line.split(" ") lbl = f_label(label) f_vector(point) f_value(radius) v=f_number(num_vertex) f_vector_array(rel_vertex,v) f_vector_array(glob_vertex,v) f_value_array(vertex_orders,v) f_value(max_radius) e=f_number(num_edge) f_value(edge_dist) ...etc I thought about putting the functions in a dict and then create a list with the proper order, but can't get it to work. A second question, all this works for small files with hundreds of lines, but some have 10. Then I can get at max 22 lists with 10 items. Not fun. I tried writing the data to a file "out of sequence", not fun either. What would be the way to do this? I thought about writing each data chunk to a proper temporary file instead of putting it in a list first. This would require at max 22 temp files and then a merge of the files into one. TIA, ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Recommended Resurce or strategy for beginning students
Thanks Alan, David and Mike, Really appreciate those thoughts and ideas suggested.. I will check out the full video David...but the part I've looked at has some great food for thought..is extremely relevant.This quote from the description is very true: "showing them how to copy-paste a few example programs and change a few parameters is easy, but bridging from there to building substantial programs is a different game entirely. This talk is about how to teach programming successfully, through comprehensible *design recipes*, which anyone can follow " Is interesting also his reference to robotsthat we could spend a year using robots...but not really getting deep learning happening...which is what I was wondering too... I think initially I do have to start with some example programsand if nothing else try and get them inspired to go further Anyway thanks...is going to be quite an interesting journey of learning for both students and teacher this Semester! Will keep looking through the suggestions and resources mentioned. Thank you, Matthew On Tue, Feb 5, 2019 at 4:02 PM David wrote: > On Tue, 5 Feb 2019 at 15:03, David wrote: > > > > 1) The given title is misleading, in my opinion its subtitle would be > much more > > representative: "Enabling students [by] example-driven teaching". > > Hi again, > > Sorry for replying to myself, but I want to correct something wrong that > I wrote above. The actual subtitle of the presentation is > "Enabling students over example-driven teaching" > and I think the intendend meaning of that is > "Enabling students [is better than] example-driven teaching". > > Also I forgot to mention that part of my motivation for writing is some > things Alan wrote: > > On Tue, 22 Jan 2019 at 20:59, Alan Gauld via Tutor > wrote: > > > > In the UK many schools use the RaspberryPi project to teach robots to > > kids as part of their Technology courses. The programming is picked up > > by osmosis on an as-needed basis. The upside is that it's a lot of fun > > and gets kids used to the concepts of hardware and software working in > > unison. The downside is that they learn a lot of bad coding habits and > > don't understand the theoretical underpinnings of either the hardware or > > software. But as a way to get them hooked it works well . > > On Mon, 4 Feb 2019 at 21:07, Alan Gauld via Tutor > wrote: > > > > I'm not a professional or trained teacher but over > > the last 30 years or so I've been involved in classes > > teaching everything from 11 years to 70+ years old > > students. I've always, without fail, found that some > > students (say 10-20% of a class) just don't get > > programming. It seems to me that some folks just > > don't have their brains wired the right way. It > > doesn't matter what tools or languages you use, it > > even happens with graphical tools like flow charts. > > Some people just don't understand the concepts of > > logical flow and problem decomposition. > > > > You can, of course, force feed these folks to some > > extent and they will pick up the basics with a > > struggle but they will never be able to create > > any significant body of code on their own. I'm > > sure psychologists etc will have an explanation > > for this but I've given up trying to explain it, > > I now just accept that some people don't think > > that way. > > I believe the video presentation addresses exactly these points. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- **Disclaimer: *Whilst every attempt has been made to ensure that material contained in this email is free from computer viruses or other defects, the attached files are provided, and may only be used, on the basis that the user assumes all responsibility for use of the material transmitted. This email is intended only for the use of the individual or entity named above and may contain information that is confidential and privileged. If you are not the intended recipient, please note that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or telephone +61 3 5382 2529** and destroy the original message.* ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor