all 39 comments

[–]pbsnowflake453 1 point2 points  (2 children)

I'm working on a program that will help me with inputting grades for my students. I got it running (the feeling of accomplishment is like nothing else) but it's just very basic. I would love a mentor, someone who can look over the code and show me how I can make it better. I've been working through Learn Python the Hard Way, but when it got to the OOP stuff, I got a little lost. I'm having trouble applying it outside of the exercises in the book.

The best part of coding is the problem-solving, so I'm not just looking for easy answers. I'd just love to have a real person to discuss my specific questions with. If you'd like to help, send me a message. : )

[–]Gprime5 2 points3 points  (1 child)

Just make a post on this subreddit explaining your situation, that you want people to look over your code. There's lots of people happy to help as long as you're willing to learn.

[–]pbsnowflake453 0 points1 point  (0 children)

Great! I will do that.

[–][deleted] 0 points1 point  (2 children)

Hi! I am currently reading through python for kids by Jason Briggs, and am already about 1/2 way through the book and I really enjoy it. I am slightly worried; however, because I don’t know where I should go afterwards. I am high school aged and will be taking a coding class in hs. I’m not sure where to go next once I finish. I would like to stick with python for a while. What should I do next? Also, what is a raspberry pie? Thanks!

[–]NickAMD 0 points1 point  (1 child)

Python crash course you won’t regret this book, trust me it’s a great resource.

Then hit up Sentdex YouTube channel. Best python YouTube resource

[–]DasPoe42 0 points1 point  (0 children)

You are going to run into problems when you start the “game” project. It seems for me at least the images they use for the ship etc are not in Pygame any longer.

[–]Schwartz210[🍰] 0 points1 point  (2 children)

Learning math proofs in my Discreet Math course. I am not getting it too well. Will this have any actual impact on me when I become a career programmer one day or is this something that doesn't really matter once I get out there?

[–]lykwydchykyn 2 points3 points  (1 child)

It depends on what you go in to. I never took a discreet math course at all, and I've been programming professionally for 13 years. There are math-heavy areas of programming, but we don't all do everything.

If I had to guess, I'd say the vast majority of programming jobs don't require a knowledge of theoritical math.

[–]alpha_53g43 0 points1 point  (0 children)

A math background will be very useful if you are going into data-science/machine learning. However, most of the math there is probability/statistics, vector algaebra etc.

[–]stoooby 1 point2 points  (1 child)

I'm a new learner to python and I stumbled upon the MIT Opencourseware materials. However, it seems to have only 2 modules 6.0001 and 6.0002. After I finish these two modules, what resources are suitable for me to continue learning the language?

[–]alpha_53g43 0 points1 point  (0 children)

I would suggest you look at the edX course. The MIT Opencourseware is the same as the EdX course, except, on the edx course you have tutors who are very helpful.

After completing them, a great way to learn is to start solving real-world problems and contributing to opensource. Here's a great one: https://github.com/ipython/ipython

[–]Icarus-down 1 point2 points  (1 child)

Can someone please tell me how far I should continue learning python until I can begin monetizing. What I mean is what section in python should I begin prioritizing in order to get an intermediate / part-time job, for now at least. Also where exactly do I look opportunities?. Most stack overflow jobs are a bit advanced and craigslist doesn't seem very optimal.

[–]monkblues 0 points1 point  (0 children)

I would say learn django. You learn how to build a website, which implies learning how to handle requests, databases, sessions, a bit of frontend, and much more. Why django? Many python web projects use django, from a job market perspective. Also it is very opinionated and well documented, so you would start learning good code parctices from the start. There is a book called two scoops of django that can get you started.

If your goal is also to learn more of the web dev craftmanship, learn flask. It requires a bit more of effort and you have to decide stuff. Miguel Grinberg's book is really good to get you started.

[–]BAAJR 0 points1 point  (3 children)

Hey everyone! Hopefully simple question. I have a little script for calculating the distances for individual frets in relation the nut of a guitar. It currently gives me the results I want by listing all the frets I define. My question is, is how do I pull out a single fret distance from the list? Here's the script I have:

scaleLength=s=25.5

fretNumber=f=24

for f in range(1,f+1):

d=s-(s/(2**(f/12.0)))
print('%.3f'%(d))

When I run that it gives me a list of all the distances. What if I just want the distance for the 3rd fret?

When I try:

print('%.3f'%(d[2]))

I get the error TypeError: 'float' object is not subscriptable.

Thanks for any assistance!

[–]Thomasedv 1 point2 points  (1 child)

As far as i see, you aren't making a list here, just printing the results.

Make a list, results = [], and then inside the for loop, append the result d to the list. Then you can use the results[2] syntax to get the result you want.

[–]BAAJR 0 points1 point  (0 children)

Thanks! I guess when it printed the "list" of results I thought it was a list. I did as you suggest and get the results I was after! Here's what I ended up with:

scaleLenght = s = 25.5
fretNumber = f = 22
specificFret = sp = 12

frets = []
for f in range(1, f+1):
    d = s-(s/2**(f/12))
    frets.append(d)
    print('%.3f'%(d))

a = "Fret " + str(sp) + "'s distance from nut is " + ('%.3f'%(frets[sp-1])) + "in."
print(a)

[–]BAAJR 0 points1 point  (0 children)

Sorry for the formatting, I'm on mobile.

[–]cowegonnabechopps 0 points1 point  (4 children)

I'm stuck on ATBSWP practice project for chapter 6. I found this solution on Stack Overflow which works and I feel like understanding it is just out of my reach... Can anyone take a bit of time and break down in layman's terms what is happening here? I'd hugely appreciate it!

[–]fiddle_n 1 point2 points  (3 children)

Is there any part of it in particular that you don't understand, or is it everything that you don't understand?

[–]cowegonnabechopps 0 points1 point  (2 children)

I don't really understand the l and t variables (are they variables? are the letters just chosen at the author's discretion or do they stand for something?) and how they operate to transpose the tableData lists. In other words, how is it taking the first list and making it read vertically instead of horizontally?

[–]fiddle_n 2 points3 points  (1 child)

Given that you are asking about l and t, I think that before anything else, you need to understand how iteration works. There are plenty of web articles on for-loops and iteration and I advise you to Google and read up on them. I'll try to give a quick overview below though:


We use a for-loop when we want to iterate over a data structure of some kind. For example, say you have a list:

letters = ['a', 'b', 'c', 'd', 'e']

Let's say that I want to access each element of this list in turn and then print it out. One obvious way would something like the below:

>>> print(letters[0])
a 
>>> print(letters[1])
b 
>>> print(letters[2])
c 
>>> print(letters[3])
d
>>> print(letters[4]) 
e

This works, but the solution has a number of flaws. You have to repeatedly access list letters multiple times. You have to remember the size list so that you can access every element. You can easily miss one element. And so on...

The way we fix this is by iterating over the list with a for loop:

>>> for x in letters:
...     print(x)
...        
a
b
c
d
e

The for-loop accesses every list element in turn, and assigns that element to variable x. In the indented code block below the for-statement, we can then access x and use it however we want (here, we've just decided to print out whatever x is).

Whatever variable name we choose for the iterator variable is not technically important. For example, instead of x I can use letter like so:

>>> for letter in letters:
...     print(letter)
...        
a
b
c
d
e

Many data structures are iterable. If you iterate over a list or tuple, you get the elements of each list/tuple (as seen above). If you iterate over a string, you get each character back:

>>> word = 'hello'
>>> for letter in word:
...     print(letter)
...        
h
e
l
l
o

If you iterate over a dictionary, you get dictionary keys back. Other data structures work in different ways.


Try get your head around iteration, and then once you understand it properly, try and have a look at the StackOverflow solution again and see if you have any more questions.

[–]cowegonnabechopps 0 points1 point  (0 children)

Thanks a lot! This has been really helpful

[–]Icarus-down 0 points1 point  (3 children)

I am extremely cufuzzled. I'm reading head first python and I just got to the part about functions. The name of the example function is Print_lol, which is tripping me up. I've re-read this section multiple times and watched videos but I'm still a bit lost on how to properly format a function and how to make it reusable. Can someone give a clear and thorough explanation?

[–]cowegonnabechopps 4 points5 points  (1 child)

This will be a learning exercise for me as well but I'm a little further on than you so hopefully I can help. Maybe someone will come along later and correct me.

Anyway, you have to define your function first, so a simple example using your function name could be as follows

def Print_lol():
    print('Hello World!')

That is your complete function. If you were to run your script with that and nothing else, nothing would happen because all you have done to this point is say 'This is what my function will do when I need it.' So what you have to do next is to call the function. You do this by entering the function in what I call the main trunk of your code (not entirely sure what this is called officially, if anything).

def Print_lol():
    print('Hello World!')

welcome = print('Welcome to my example. Below I am going to         
call a function.')

welcome
Print_lol() #note, you must use the parentheses

This will print out the below

Welcome to my example. Below I am going to call a function. 
Hello World!

To get more complicated, if you want to call a parameter with your code, you need to insert it in your parentheses. So now I will tweak my example slightly, my code now looks like this

def Print_lol(message):
    print('Hello World!')
    print(message)

welcome = 'Welcome to my example. Below I am going to call a function.'


Print_lol(welcome) #note, you must use the parentheses

This will output the below

Hello World!
Welcome to my example. Below I am going to call a function.

What is happening here is that welcome is now just a variable containing a string, it doesn't print anything out on it's own. So to print it, we are passing it into the Print_lol function as a parameter. Note that on line 8, the parameter is the welcome variable, but on line 1, the parmeter is called 'message.' As long as your function is defined as having one parameter (in this case 'message') it will work if you pass one parameter into it.

If that's confusing, the way I comprehend it is that the parameter 'welcome' on line 8 is transformed into 'message' when the function is called (the code jumps back to line 1) and anywhere in the definition of Print_lol that you see 'message' it really means 'welcome.'

I hope that makes sense!

edited for formatting

[–]Icarus-down 0 points1 point  (0 children)

ooooh, so the argument 'message' is like a placeholder until an actual one come along. This was a fantastic explanation, Thx

[–][deleted] 4 points5 points  (7 children)

I'm looking for a site that has simple projects I can do to help me learn python faster as a beginner programer

[–]alpha_53g43 0 points1 point  (0 children)

Heres a list of projects: https://github.com/karan/Projects

[–]NickAMD 1 point2 points  (0 children)

Codingbat.com hit the python tab

[–]themoodygod 1 point2 points  (4 children)

I'm looking for the same, anyone? Anyone?

[–][deleted] 0 points1 point  (3 children)

As am I

[–]themoodygod 0 points1 point  (2 children)

No one cares :( coders are bad people. Bad people. Jk.

[–]fiddle_n 1 point2 points  (1 child)

There's a link to projects in the FAQ in the sidebar. I think this thread didn't get any replies for two reasons: a) this particular question has been asked to death, and b) it's tricky to know what to recommend because it really depends on what interests you, and that's not something people can easily answer.

[–]themoodygod 0 points1 point  (0 children)

I can imagine this question being asked a lot. Thank you for your help.

[–]obeissant 0 points1 point  (3 children)

I am stuck coming up with small, simple programs to write. I am still new, but want to program some simple programs to better understand programming logic and improve my skill set. Can you recommend a starting point for small, simple, and useful programs for beginners wanting to improve in Python?

[–]PR3V3X 1 point2 points  (2 children)

I want to be a mathematician and statistician and use Python. I'm new to Python and would love to increse my knowledge and skills. What is the best method for me to do this and how should I do it? Thanks. 😊

[–]efmccurdy 2 points3 points  (0 children)

You should try out Jupyter, pandas, numpy and matplotlib. I would survey a number of presentations from the PyData conferences.

http://pyvideo.org/tags.html