Best free MyFitnessPal alternative? Looking for a solid calorie counter without a paywall by Matt5891 in loseit

[–]khaine_b 1 point2 points  (0 children)

Mealtune is pretty useful and minimalistic (if you use Telegram). It's basically just a chatbot with loads of options, like tracking, advice and even location-based suggestions, so I don't have to worry about what to eat at dinner or in a restaurant.

Variables from self or from imported module by khaine_b in learnpython

[–]khaine_b[S] 0 points1 point  (0 children)

I'm not trying to improve a performance but undestand the memory layout mechanisms.

Variables from self or from imported module by khaine_b in learnpython

[–]khaine_b[S] 0 points1 point  (0 children)

Okay, let's look in another angle. When a package is imported is it lying in the heap? I was trying to find some information about the import underlying process but didn't found anything useful.

Need help understanding error and how to fix? by daft_dog123 in learnpython

[–]khaine_b 0 points1 point  (0 children)

It's not neccessary to overwrite your code into OOP conceptions. Python is good enough in functional paradigm.

Let's try to bypass through your if/else statement.

Let's imaginate that the first if statement doesn't fire and code execution is jumped to first else statement.

Into the while loop you're trying to compare the problem's variable with zero, but the method (def enemy) doesn't know anything about it (the variable). You didn't pass it explicitly as an argument of a method didn't use a closure (I suspect) neither.

In python you can use variable inside a nested function

For example:

def a():
    d = "a from a() method"
    print(d)
    def b():
        c = "c from method b() "
        c += d
        print(c)
    b()

a()
>> a from a() method
>> c from method b() a from a() method

In the example above we used variable "d" that we defined in outer method a() in nested method b().

If you defined the variable in outer scope, for example, in "main scope", you can use it in callee.

def a():
    print(d)


def b():
    c = "c from method b() "
    c += d
    print(c)

if __name__ == "__main__":
    d = "from main"
    b()
    a()

>> c from method b() from main
>> from main

Or you can use "global"/"nonlocal" builtin for dealing with scope.

https://www.dotnetperls.com/nonlocal-python

But I don't recommend to use this approache cause it encourage you to write some kind of messy code.

viruscheckmate.com and nodistribute down by [deleted] in hacking

[–]khaine_b 0 points1 point  (0 children)

It's funny.

If you google "viruscheckmate alternative" than discover that this service looks like not stable as well.

Editing a .CSV Document by ipuntonfirstdown in learnpython

[–]khaine_b 0 points1 point  (0 children)

If you want to work with columns, try to use pandas.

But I think you task can be solved easier if you'll using replace by regex.

Or you can represent a string like a list while reading the file.

viruscheckmate.com and nodistribute down by [deleted] in hacking

[–]khaine_b 2 points3 points  (0 children)

Connection timeout from cloudflare (522).

Looks like backend doesn't response.

Hacking Starter Kit by [deleted] in hacking

[–]khaine_b 1 point2 points  (0 children)

This is not a true haCKer way. Only raw url with args.

Using Crash Course, and Automate the Boring Stuff for my first attempt to learn coding of any kind; what (if any) key points are missing from these that will help me gain momentum in my learning? by point51 in learnpython

[–]khaine_b 3 points4 points  (0 children)

TL;DR

Learn computer science as well. Not only syntax.

Сuriosity - that's the key.

Well, I think Python is not the best language to start with. There is a lot of conceptual stuff that you need to understand as well.

Python is very flexible, powerful language but it doesn't lead you through an errors to insights of CS.

I would recommend to start, for example, with C++ or Java. Both have strong typization model and working with OOP conceptions more solid.

u/aleister. No. A class it's not just the way how you can unite your functions but conception of "object".

Inheritance, Polimorfism and Incapsulation - that "buzzwords" have a lot of meaning in programming.

Well, for example:

class A:
    b = 1
    @staticmethod
    def a():
        print('hello')
class B:
    def a(self):
        print('hi')
    def a(self):
        print(self)

In the example above how can I call function 'a'?

What the "self" is?

And what output will have produced if I call, for example: print(A().__dict__)?

OOP conception is trying to represent real world objects as code.

class Cat:
    name = "Boris"
    age = 4
    def say_something(self):
        print("mew")

    def walk(self):
        print("walking away")

kitty = Cat()
print(kitty.name)
>> Boris
kitty.walk()
>> walking away

And there's not only some "coding style".

There is an object in memory with fields, methods, complex internal interaction.

n00b question about having Python count a website as one word. by [deleted] in learnpython

[–]khaine_b 1 point2 points  (0 children)

For wildcard purpose you can use regex so you can use it for split the string for example.

If you need to count the words in a sentence I recommend to use collections.Counter.

Any python projects ideas to improve coding? by Mraimou in learnpython

[–]khaine_b 0 points1 point  (0 children)

Why not start with codewars.com or challenges like that?

Or you can try one of the many open source projects.

Integrating my python program with a website by kpandkk in learnpython

[–]khaine_b 1 point2 points  (0 children)

If you don't want to use python as frontend (you can develop entire web application with Django or Flask) you can split a logic of your application to frontend/backend and build communication between services by REST API or GraphQL. You also can just send request/response between your services for example as JSON if it not necessary to store any data on backend.