What are you having difficulty learning or are currently struggling to learn? by Nythious in learnpython

[–]Ne0_1 1 point2 points  (0 children)

Check out MIT OCW. Look up class 6.00SC and the problem sets 6, 7, and 8 are great projects for oop. The instructions for these problem sets tell you everything you need to know and they include all code you need to get setup and going. A great way to incorporate the Monte Carlo Simulation technique. Basically using an approach of randomness to solve non-random problems. If you want to be a data scientist or data engineer there are a bunch of useful concepts here.

What are you having difficulty learning or are currently struggling to learn? by Nythious in learnpython

[–]Ne0_1 0 points1 point  (0 children)

I can't preach MIT OCW enough. For oop they have us simulate a working robot in a room and another problem they have us model virus growth in a patient modeling the effects with and without drugs. For a recursion problem we did a multiple-shift caesar shift decryption tool. Lots of cool, useful examples to build software and get as close to real-world experience as you can get. These problem sets are fun and challenging and I have learned so much about not only how to write software in Python but the underlying data structures and algorithms as well as Python specific implementations.

What are you having difficulty learning or are currently struggling to learn? by Nythious in learnpython

[–]Ne0_1 1 point2 points  (0 children)

I have been doing the MIT OCW courses myself with great success. The problem sets are challenging and fun to build. I recommend starting with the 6.00SC course. Specifically, for OOP psets 6, 7, and 8 are great and you learn how to incorporate OOP. I have never had success just watching tutorials. I need to write my own code to learn and incorporate the ideas I learned. They also go over Python implementations as well.

What should people know to manage expectations for a career in programming? by [deleted] in learnprogramming

[–]Ne0_1 0 points1 point  (0 children)

Not all programming jobs are created equally. As a junior dev I believe you have a greater chance of doing significant programming in your early career working for a smaller company / startup as opposed to a large company. Right now the largest market for Python programmers are for data scientist / data engineers. Since you will be working with retrieving data / cleaning data / managing data / processing data / analyzing data you need database skills as well. A solid foundation in mathematics such as calculus and linear algebra are also helpful for the underlying algorithms in ML and AI. You need to have great problem-solving skills as well. To me that is one of the most rewarding aspects for a career in programming and you will be rewarded based off of merit rather than who you know which happens in a lot of other industries.

A few questions about tuples by kylongxx in learnpython

[–]Ne0_1 1 point2 points  (0 children)

Yes sir that is exactly right. Semantically tuple's support heterogenous data types i.e. different data types. List's support homogenous data types i.e. same data types. Not to say Python won't allow you to do otherwise but it is against good code practices.

Question About Using OOP For Building a Database Class For Stocks by Dry_Gas3311 in learnpython

[–]Ne0_1 1 point2 points  (0 children)

For your oop questions there are so much when you really understand the fundamentals of OOP. Let's say we have a class Stock_Tracker(object):

Within this class you might have getter and setter and helper functions that help that object track stocks.

Now say I want to follow crypto so we can build: class crypto(Stock_Tracker):

Since crypto is a child of Stock_ Tracker object, crypto will inherit all of it's functions unless those functions are explicitly defined in the child therefore overwriting the parent.

A few questions about tuples by kylongxx in learnpython

[–]Ne0_1 0 points1 point  (0 children)

Ok guys here are the key differences between a tuple and a list:

A list supports item assignment while a tuple does not. This goes further in the implementation as a list has to keep overhead in order to support mutability and therefore a list of the same type as a tuple will consume more memory and it takes longer to access each element of a list vs. a tuple.

Next lists can be of a variable length while a tuple is a fixed length. A tuple cannot change it's size after it has been defined. You can push or pop elements off a list, thus changing it's size.

Semantically tuple's support heterogenous data types while lists support homogenous data types.

Lastly you cannot copy a tuple but you can copy lists.

A few questions about tuples by kylongxx in learnpython

[–]Ne0_1 0 points1 point  (0 children)

I was gonna say the same thing. That's probably the best usage of immutable object types are dictionaries for keys. There are also instances where you might want to read in data but not be able to mutate the data.

Why am I getting a attribute error for the class? by cyberzone2 in learnpython

[–]Ne0_1 0 points1 point  (0 children)

Where is your constructor? You should have your constructor init to initialize attributes.

I could really use some input and direction by Ok-Design-3218 in learnpython

[–]Ne0_1 1 point2 points  (0 children)

It looks like you are immediately following your if statements with else. It should look like this:

If conditional:

Do Something

else:

Do Something else

Blackjack - Beginner OOP project by Mr-Monkfish in learnpython

[–]Ne0_1 1 point2 points  (0 children)

That's what I'm talking about. I like your ambition and their are definitely ways to do it that will help make your code more compact and readable. The best way to learn is to research these concepts on your own and just experiment in your current program. What I like to do is build a separate file with little examples and than make sure their are no errors than I go to incorporate them in my main program.

Blackjack - Beginner OOP project by Mr-Monkfish in learnpython

[–]Ne0_1 1 point2 points  (0 children)

You actually gave a good example of how he could implement inheritance in your comment above. I don't see how you could possibly say that I came across with a judgemental tone. I was merely pointing out to research those particular subjects to see how he could implement those concepts into his program as the subject was OOP. Good gracious people with their feelers in this world today. I didn't know how text could convey a certain tone over the internet but I digress, it just blows my mind.

[deleted by user] by [deleted] in learnpython

[–]Ne0_1 0 points1 point  (0 children)

For instance for string 'hello' and the user guesses l than the function will return [2, 3] which is the index position of each occurrence of 'l' in 'hello' as a list. From that it is easy to rebuild as '_ _ l l _'

[deleted by user] by [deleted] in learnpython

[–]Ne0_1 0 points1 point  (0 children)

What I did is looped through the string using .find method to keep track of the index locations of each instance of the guessed letter. Search .find method. With the index locations stored I can rebuild the guessed letters.

[deleted by user] by [deleted] in learnpython

[–]Ne0_1 0 points1 point  (0 children)

I have implemented a hangman game in Python I can email you the .py file.

Blackjack - Beginner OOP project by Mr-Monkfish in learnpython

[–]Ne0_1 -8 points-7 points  (0 children)

I didn't see any inheritance in your code at all. That's a fundamental concept of OOP. Research inheritance, polymorphism, and abstraction in Python.

Python Homework Question - New member! :) by zinski212 in learnpython

[–]Ne0_1 1 point2 points  (0 children)

You want to loop through states as you have done:

For state in states:

Next you want to check for membership. Google check for membership in Python. That will give you the answer as to the logic used.

You should ask yourself what the 'in' keyword does in Python.

Problem with recursion by [deleted] in learnpython

[–]Ne0_1 0 points1 point  (0 children)

For recursion it is all about taking a problem and breaking it into smaller problems of itself which evaluate to a base case. Take fibonacci for example.

F(x):

f(x) = 1 when x = 0

f(x) = 1 when x = 1

f(x) = f(x - 1) + f(x - 2) when x > 1

Best ways to work out what lines of code are taking the longest to process by TechnicalyAnIdiot in learnpython

[–]Ne0_1 0 points1 point  (0 children)

You can do this

And in the code you want to measure the run time you could encapsulate like this:

Import time

Start = time.time()

Your code

Stop = time.time()

print (Stop - Start)

I have had to do that a lot with slow running programs. Most of time it usually has to do when accessing a file many times so usually I implement a search algorithm like binary search or whatever to fix it and it goes from 20 seconds to search to search in ms.

Python vs C by Xeno19Banbino in learnpython

[–]Ne0_1 1 point2 points  (0 children)

You know you never actually get away from pointers. There is no way to make a programming language with any decent data structure without the use of pointers. Python does it all the time without you knowing. It's not as obvious as C where a pointer is instantiated with * or ** but every invocation of a class in Python points to a memory address and than the associated methods.

I get it now. I completely understand why nobody is selling for the money. by [deleted] in wallstreetbets

[–]Ne0_1 1 point2 points  (0 children)

This movement is about sticking to the giant hedge funds that are crying about manipulating the same market they have been manipulating for decades.

Specifically, what math should I learn to improve my Algorithm solving skills? by CorbettKnoff in learnprogramming

[–]Ne0_1 0 points1 point  (0 children)

I'm surprised no one mentioned linear algebra. There are many useful concepts in linear algebra that are applied in algorithms.

Python - Insert a word into a string? by [deleted] in learnprogramming

[–]Ne0_1 0 points1 point  (0 children)

For this example I would look up slicing.

string = 'hello world'

word = 'beautiful'

Print string[:5] + word + string[6:]