Coding / Programming Language : Python - Tips, Advice & Discussion

What Is Your Level With Python?


  • Total voters
    8
Jun 4, 2013
23,468
5,618
Well, I'm not an expert or anything of the sort, I've just seen references mostly

https://automatetheboringstuff.com/chapter12/

You can control excel from python, so essentially you can do your normal script - which interacts with software, websites, scraping from websites, and then within the script state exactly how you want it to interact with excel.

Googling for python excel permutation seems to bring up a lot of results.


http://pbpython.com/xlwings-pandas-excel.html
Why did I not get a notification for this?

That's pretty cool. I'm bookmarking that pandas thing.

I actually asked my advisor today how he got good at scripting. He said it's all about doing and not learning. He didn't do bootcamps or anything. He just picked it up and started playing around with it.

Man, if I could figure out how to automate barcharts from matrices in Excel, I think I could get paid a lot of money for that script. Get the python pipeline to spit out the right matrix and then get Excel to incorporate that matrix, get the proper means, std dev, and std errors, then get a barchart of all the correct things. Shit, I'll be making a lot of money from that.
 
Last edited:

Jay

May 31, 2012
12,770
1,001,600
Stoke-ish
Why did I not get a notification for this?

That's pretty cool. I'm bookmarking that pandas thing.

I actually asked my advisor today how he got good at scripting. He said it's all about doing and not learning. He didn't do bootcamps or anything. He just picked it up and started playing around with it.

Man, if I could figure out how to automate barcharts from matrices in Excel, I think I could get paid a lot of money for that script. Get the python pipeline to spit out the right matrix and then get Excel to incorporate that matrix, get the proper means, std dev, and std errors, then get a barchart of all the correct things. Shit, I'll be making a lot of money from that.
Possibly because I added in your 'snip' afterwards. I hope. Otherwise we have bigger problems and I'm in trouble :lol:

Yeah, the most I've learnt from powershell is when I have a use case, and then I go figure it out. Then I incorporate stuff from that into other scripts, then it just starts to come together. Bit of learning of basics as well helps then you just keep using even when you don't need to. That's when things start to sink in and you don't need to think about what the syntax is for basic stuff.
 
Jul 24, 2012
8,365
8,137
I've started the codeacademy course for the basics but I'm at that stage where I'm learning incredibly boring shit, like getting the program to display text by typing

print ("Hi Ya Cunt")
*run*
Hi Ya Cunt

and then doing some simple calculations and creating variables ... this is the tricky bit for me though, getting through all this incredibly boring shit to try to get to something useful and interesting ... I'm going to persevere though ... in my opening post, I think I might continually edit this to add resources that are added to the thread e.g. IDEs, tutorial links, software download links, etc
 
Reactions: Mexi-Box
Jun 4, 2013
23,468
5,618
I've started the codeacademy course for the basics but I'm at that stage where I'm learning incredibly boring shit, like getting the program to display text by typing

print ("Hi Ya Cunt")
*run*
Hi Ya Cunt

and then doing some simple calculations and creating variables ... this is the tricky bit for me though, getting through all this incredibly boring shit to try to get to something useful and interesting ... I'm going to persevere though ... in my opening post, I think I might continually edit this to add resources that are added to the thread e.g. IDEs, tutorial links, software download links, etc
I went to a free course taught by the college I'm affliated with for R and Fortran. They took about half the fucking day doing basic, pedestrian shit. It was a complete waste of time because I was way, way ahead of that.

Then the script she created was super fucking easy. I wanted to see her make a complex algorithm or something. That'd be useful.
 
Jul 24, 2012
8,365
8,137
I went to a free course taught by the college I'm affliated with for R and Fortran. They took about half the fucking day doing basic, pedestrian shit. It was a complete waste of time because I was way, way ahead of that.

Then the script she created was super fucking easy. I wanted to see her make a complex algorithm or something. That'd be useful.
I'm trying to keep a positive attitude that these are basic building blocks and you need to get this shit down tight or you will fall down later at more complex coding.

I'll try to get cracked on with this at the weekend at some point... like you I'm interested in something which interfaces with excel and automates some stuff but generally, I just want to have one one coding language under my built to a workable level to give me a foundation in coding.

I'm assuming that those skills can be transferable to other languages after that, although the syntax will be different, is the process and way you approach coding different for each language?
 
Reactions: Mexi-Box
Jun 4, 2013
23,468
5,618
I'm trying to keep a positive attitude that these are basic building blocks and you need to get this shit down tight or you will fall down later at more complex coding.

I'll try to get cracked on with this at the weekend at some point... like you I'm interested in something which interfaces with excel and automates some stuff but generally, I just want to have one one coding language under my built to a workable level to give me a foundation in coding.

I'm assuming that those skills can be transferable to other languages after that, although the syntax will be different, is the process and way you approach coding different for each language?
I use 3 different coding languages in my work. I'd say the skills are the same, but the syntax is pretty different in a lot of cases. You can Google what means what pretty easily. If I take a month off working, I have to come back and start from the basics, but I think doing for me is more powerful than sitting through lectures. Everytime I come back and redo all the basics it's cemented in my head more and more.

I think I've learned more hitting walls and watching YouTube videos than sitting through instructor courses.

I don't sweat the basics at all. I try a more skill-based approach, if that means anything. And yes, the skills can be transferred.
 
Reactions: Broxi
Jun 4, 2013
23,468
5,618
The whole thread is worth trawling through as there’s quite a few decent Python courses and books in there.
I was actually noticing that. I might scan through it. That course on Udemy doing data analysis with R and Python looks absolutely killer. It's pretty much spot-on the type of data analysis tools I use.

Only thing is that, very likely, it won't teach me anything I don't already know. I'm not paying for shit like that, but I wouldn't mind scouring through and seeing some tips.
 
Jun 5, 2013
7,426
4,564
Oz
I was actually noticing that. I might scan through it. That course on Udemy doing data analysis with R and Python looks absolutely killer. It's pretty much spot-on the type of data analysis tools I use.

Only thing is that, very likely, it won't teach me anything I don't already know. I'm not paying for shit like that, but I wouldn't mind scouring through and seeing some tips.
Fill yer boots. It doesn’t seem a particularly popular thread, geeks aside, but there are some gems in there.
 

Dazl1212

Ripley, strong independent woman who don't no man
May 16, 2013
19,521
5,927
UK
Hi Guys,

So I have to do this
produce a simple graphical representation of a set of nested squares, . The output should comprise of 4 squares. The squares should have sides of length 20, 40, 60 and 80, respectively

It should be able to produce larger numbers of nested squares simply by changing one number that specifies the number of squares

with the turtle starting at the position that we want to be the top left hand corner of the innermost square and the turtle pointing to the right.

I have written this

# Nested square
from turtle import *
number_of_shapes = 4
for shape in range(1, number_of_shapes + 1):
# Draw a square
for sides in range(1, 5):
forward(shapes * 20)
right(90)

# Move forward to start position of next square
penup()
forward(20)
pendown()

I get an error code forward(20 + shapes * 20)

and another error at Forward (20) further down.

Any ideas?
 
Jul 29, 2014
1,842
1,193
UK
Hi Guys,

So I have to do this
produce a simple graphical representation of a set of nested squares, . The output should comprise of 4 squares. The squares should have sides of length 20, 40, 60 and 80, respectively

It should be able to produce larger numbers of nested squares simply by changing one number that specifies the number of squares

with the turtle starting at the position that we want to be the top left hand corner of the innermost square and the turtle pointing to the right.

I have written this

# Nested square
from turtle import *
number_of_shapes = 4
for shape in range(1, number_of_shapes + 1):
# Draw a square
for sides in range(1, 5):
forward(shapes * 20)
right(90)

# Move forward to start position of next square
penup()
forward(20)
pendown()

I get an error code forward(20 + shapes * 20)

and another error at Forward (20) further down.

Any ideas?

Please provide the error code. I have a video clip I can send you later which I believe will help you with what you are trying to do perfectly. I'm away until this evening but PM me if you want it and i'll send it across.
 

Dazl1212

Ripley, strong independent woman who don't no man
May 16, 2013
19,521
5,927
UK
I cracked it on Monday, it took me two hours of watching videos and failing before I finally got it working.

This is my first foray into real programming since I was pissing about with Basic at 8 on my spectrum. Not sure whether to be proud or embarrassed :lol:
 
Reactions: Broxi
Jul 29, 2014
1,842
1,193
UK
I cracked it on Monday, it took me two hours of watching videos and failing before I finally got it working.

This is my first foray into real programming since I was pissing about with Basic at 8 on my spectrum. Not sure whether to be proud or embarrassed :lol:
Shit sorry mate, forgot to send that video over. Glad you got it sorted.
 
Reactions: Dazl1212
Jul 29, 2014
1,842
1,193
UK
Anyone still cracking on with this? I recently bought myself a book. Python programming for the absolute beginner. I'm determined this time to see it out and gain myself a new skill. I'm 250 pages through the book. It's pretty decent and you basically learn the concepts by making games. I'm getting through this pretty quick and most importantly I seem to be understanding what I am doing and why.

one more chapter and I'm getting introduced to the GUI!
 
Jul 24, 2012
8,365
8,137
No, LOL, I did my usual and messed about with it for a week or so, got bored of not being able to do cool shit instantly and switched to fannying about with Photoshop, Premier Pro and After Effects tutorials instead ... then promptly shit-canned that idea too.

Decided that just watching boxing on Youtube holds my interest more.

I'll try and get back into it at some point.
 
Reactions: NSFW
Oct 27, 2013
1,000
545
30
Boston
Anyone still cracking on with this? I recently bought myself a book. Python programming for the absolute beginner. I'm determined this time to see it out and gain myself a new skill. I'm 250 pages through the book. It's pretty decent and you basically learn the concepts by making games. I'm getting through this pretty quick and most importantly I seem to be understanding what I am doing and why.

one more chapter and I'm getting introduced to the GUI!
tkinter?

I took two programming courses when I was an undergrad, they were based on Python. We covered functions, loops, dictionaries, even a little bit with object oriented programming. I actually kind of liked it but it wasn't related to my major- I took it as electives so I didn't stick with it in the long run (have not really gone back to it after the classes). I still have all my course notes and assignments somewhere.

For the coding we used Spyder. I know some people frown upon starting off using ide's but I found it very useful b/c it saved me hours from finding a simple spelling/spacing mistake.

I used that learn the python the hard way book as a companion to my textbook. It was a helpful resource.


There was a good course on www.codeacademy.com but it was in python 2. This is almost End of Life/support, so is useful only for legacy code, if you're learning, it's python 3. There's not much difference, just a bit of syntax especially in print() etc.

I have quite a few things and links at home which I'll put up. I'm not close to an expert and haven't really coded anything from scratch, but I've learnt it enough to read/amend most exploits and scripts I use in Penetration Testing
Trying to get into cyber security? Linux and Bash scripting are huge but you probably already know that.
 
Last edited: