Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
7 votes
4 answers
963 views

Project Euler #54: class for poker hands

I'm working right now on Project Euler problem 54, and I figured that this was the perfect opportunity to try to work with classes. This is my first time, so I'm sure that there are a lot of style, ...
Brais Romero's user avatar
10 votes
2 answers
1k views

A simple Python class designed to facilitate investment portfolio analysis

Background In an attempt to learn a bit more about investing and economics, I've begun writing a simple historical portfolio analysis tool in Python. The ...
IntegerEuler's user avatar
2 votes
1 answer
91 views

Dynamically mapping an API's setting IDs to instance methods using Descriptors

I'm working with an API, where the url can be constructed with setting_ids. To more clearly indicate the functionality of the setting ids I am mapping them to a WriterClass' methods, with relevant ...
Floriancitt's user avatar
1 vote
2 answers
160 views

Mapping an API's setting IDs to setting names with class methods, enabling clearer utilization

I'm trying to access an API using the requests library in as clean a manner as possible. The API is accessing various settings of various devices. I'd like to keep my code as readable and ...
Floriancitt's user avatar
1 vote
1 answer
83 views

Python3 tokenizer abstract baseclass ( Without the permission to be instantiated directly )

I'm a newbie python developer, and fortunately I have been introduced to the principle of abstract base classes and they seemed pretty interesting to tackle while going forward in my Python journey. I'...
KhodeNima's user avatar
  • 419
1 vote
1 answer
229 views

Python3 currency abstract class (without the permission to be instantiated directly)

I'm a newbie python developer who accidentally studied the concept of Abstract classes and I found it pretty much helpful to implement due to the SOLID principles. At the very moment of testing and ...
KhodeNima's user avatar
  • 419
2 votes
2 answers
590 views

Python: Sorting Marbles with switch and rotate - Need help in optimizing a working solution

I have made a couple modifications to the switch/rotate routine for the classic Marbles game. The modifications are Using a random_select method that can help pick either switch or rotate Create a ...
gaurav8936's user avatar
0 votes
1 answer
171 views

Equation calculator

Function Calculates values for user defined equations. Just a concept right now. I plan to add many more equations. Equations in code Density: $$ p = \frac{m}{v} $$ Speed: $$ s = u + a \cdot t $$ <...
Nickotine's user avatar
  • 388
0 votes
1 answer
68 views

Comparing custom Geometry classes (Lines and Planes): How to increase the accuracy of the __eq__ method

I'm creating custom classes to represent Planes and Lines on a 3d graph. To help improve the performance of my process I've started implementing __eq__ so that I ...
Mandelbrotter's user avatar
-1 votes
1 answer
52 views

Class method instantiates another class while passing its self as an argument [closed]

I have the following code. I have made a complicated approach to calculate apple's price. Thus, I put this approach in a separate class called PriceUtl. The code ...
aura's user avatar
  • 251
5 votes
1 answer
308 views

Let's get random, extending Python's base random class

So Python's base random class uses the Mersenne Twister as its base for seeded random number generation. If available, it can use /urandom/, but that is beside the ...
N3buchadnezzar's user avatar
1 vote
3 answers
171 views

A Class that creates a unit of Stock or a collection of Stocks

I have a dataclass of a single class object 'AStock' as such: ...
mrkgoh's user avatar
  • 11
1 vote
1 answer
52 views

When I try to re set up my code after failing in the game I cant get it to run the function without its own file being undefined [closed]

I know my code is ugly and unreadable. I originally had the game working without class functions but when I had to implement class function it all went downhill. TennisMaster.py ...
RobbieAwesome's user avatar
8 votes
3 answers
3k views

Calculate evapotranspiration

I am trying to create a code for the Basic evapotranspiration equation by Hargreaves. I have attached a screenshot of the equation to be replicated. I want to create a class wherein I can input data ...
jeronimo dcosta's user avatar
3 votes
1 answer
53 views

Weekly Dose tracker with time and dose mean

Function: Outputs daily and weekly dose totals with means for time between doses and dose amount. Code: ...
Nickotine's user avatar
  • 388

15 30 50 per page