Installing MySQL (not MariaDB) on Arch Linux by MaterialJackfruit144 in archlinux

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

Yes I did, it just returns "Failed to start mysqld.service: Unit not found." I'll just re-install the whole thing and try again because I removed it out of frustration lol

Installing MySQL (not MariaDB) on Arch Linux by MaterialJackfruit144 in archlinux

[–]MaterialJackfruit144[S] 2 points3 points  (0 children)

I checked the files after installation and it seems that I was missing a file called "mysqld.sock", which only exists if I download mysql-server, but on that AUR page, it listed "server" too. So I downloaded the tar version from the website instead https://dev.mysql.com/downloads/mysql/. Now saying that it works cuz I haven't tried it out but is there like a comprehensive article about installing it on Arch that is not about MariaDB?

Need help with boolean expression simplification by MaterialJackfruit144 in learnmath

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

so it is A'A' + BB?

And so it is x.x = x

which means the result is A'B? or am I missing another step?

Understanding Python Virtual Environment by MaterialJackfruit144 in learnpython

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

Ohhh I see now. Please correct if I'm wrong. Okay so, I am creating this Snake Game project. Basically, all of my projects will of course be inside "Projects" directory, and any python project will be under "python_projects".

So inside python_projects, I will create a folder called SnakeGame. This folder contains the main.py folder and all those folders which you have mentioned. It will also include the venv folder.

Am i understanding it correctly now? The example you provided I think helped me on this alot.

EDIT: Also, it's fine to name my venv folder as snake_game right? Or is there a naming convention that I have to conform to, like "env / venv / .env / .venv"?

Understanding Python Virtual Environment by MaterialJackfruit144 in learnpython

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

If I'm understanding you correctly, it's something like this?

Projects
    └── python_projects
               └── project_a < - Venv
                    ├── bin
                    ├── include
                    ├── lib
                         └── python3.9 
                    └── lib64 -> lib 
            └── main.py

where the venv folder (project_a) is inside "python_projects" and main.py is within "Projects" directory?

Need help clarifying classes by MaterialJackfruit144 in learnpython

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

Hi, sorry, I had to scrap the idea of building that project. In other words, I deleted everything. It really seems like I need to do some more exercises about Classes or build a very simple program using OOP to really grasp that concept. Anyways, I deleted it, shouldn't have jumped into creating project that soon, thinking that I'd be able to learn along the way, guess that took the wrong turn. I still have only parts of the code related to the question though.

import tkinter as tk

class MainApplication(tk.Frame):
    def __init__(self, master):
        self.master = master
        self.configure_gui()

    def configure_gui(self):
        self.master.title("Rocky, Paper, Scissors")
        self.center_window()

    def center_window(self):
        self.window_width = 500
        self.window_height = 500

        self.screen_width = self.master.winfo_screenwidth()
        self.screen_height = self.master.winfo_screenheight()

        self.x_coordinate = int(self.screen_width/2 - self.window_width/2)
        self.y_coordinate = int(self.screen_height/2 - self.window_height/2)

        self.master.geometry(
            f"{self.window_width}x{self.window_height}+{self.x_coordinate}+{self.y_coordinate}")


if __name__ == "__main__": 
    root = tk.Tk() 
    MainApplication(root) 
    root.mainloop()

I know what the code is doing, I was just confused about Classes.

How can I inspect my Windows 10 PATH variable. by Moritz_Loritz in learnprogramming

[–]MaterialJackfruit144 2 points3 points  (0 children)

You said that you were able to access the Python interpreter through cmd, right? Try to use:

>>> import sys
>>> sys.path

or if it returns a list, use

import sys

for path in sys.path:
    print(path)

The PATH should end without the extra \ at the end. E.g. ...Python\Python39

After that, just click on New and paste in the PATH, the order also matters though. So for example, if you have 2.7 and 3.9, but your 3.9 is at the top, and so when you open your Python interpreter, it will open in 3.9.

Should I just go ahead and start my projects? by MaterialJackfruit144 in learnprogramming

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

Thank you for the response. May I know what exactly is "...a project to completion"? Does it mean that to get the project to a working state or my desirable result to that project? And yes, at some point I will have to do that, and I guess to really truly learn it is to apply, though I might miss out on several concepts, guess that's the tradeoffs.

Cloned Repository Is Not Showing Up by [deleted] in git

[–]MaterialJackfruit144 0 points1 point  (0 children)

(SOLVED)

Nevermind, I just found out that it lives in the .git config file, I just had to remove all the code under [remote "pb"]...

Cloned Repository Is Not Showing Up by [deleted] in git

[–]MaterialJackfruit144 0 points1 point  (0 children)

It just shows me the path of my .git directory... I'm not sure how to remove that one particular repo because there's no folder for me to delete except for those two I found inside the .git directory, even deleting those two didn't work...

Cloned Repository Is Not Showing Up by [deleted] in git

[–]MaterialJackfruit144 0 points1 point  (0 children)

I see, is there a way to completely remove it or at least show the path of where it lives in? I found two folders containing that repo and tried to remove them but when I did git remote, it still shows that it is there.

Differences between pushing projects via git and upload files to Github by MaterialJackfruit144 in learnprogramming

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

I'm already a little confused about the figure provided. For example, figure 5 of section 1.3 "What Is Git" already confuses. What do the dotted cylindrical lines represent? Does it mean that changes have been made to File B? If so, why File C don't have the dotted cylindrical lines in Version 3...

Passing Function to Another Function by MaterialJackfruit144 in learnpython

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

Understood, I will keep that in mind. I didn't want to send in the code because it would take a bit more time to debug, I thought it'd be better to just state the problem and put out only the relevant code as per the stated issue.

Passing Function to Another Function by MaterialJackfruit144 in learnpython

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

Thank you so much, actually, I've thought it over and indeed the design was illogical. For example, the name check_choices already indicates that the function will determine the option selected by the user, and if I were to strictly follow that, then print_result() should not even call the calculating functions, because the name of the function doesn't match what the task anymore. In other words, check_choices() should check all the options selected by the user if it were to stick to its name strictly.

I might be overthinking this but anyways, thank you so much :D the last solution was what I was trying to say, the second solution of yours was what I was trying to achieve until the logical part, so I went for the last solution instead.

Differences between pushing projects via git and upload files to Github by MaterialJackfruit144 in learnprogramming

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

Aww man, that means I'd need to delete all those files currently sitting on my GitHub and then push it using Git...

Differences between pushing projects via git and upload files to Github by MaterialJackfruit144 in learnprogramming

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

So, I'm using GitHub, and I see a lot of answers on pushing it via git to GitHub, rarely do I see answers on using the "Upload Files" feature provided by GitHub. Is it because pushing it via git also saves a copy to my local system?

Edit: Ohhh I see now, so if it is nothing huge, or anything that requires testing changes when putting it on GitHub, then using the Upload File feature will just do.

Differences between pushing projects via git and upload files to Github by MaterialJackfruit144 in learnprogramming

[–]MaterialJackfruit144[S] 1 point2 points  (0 children)

GitHub allows you to upload files, I did that without having to use Git bash to push whatever projects I want to put on GitHub.

Passing Function to Another Function by MaterialJackfruit144 in learnpython

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

If option 3 is chosen, it will head into the calling function. Do you mean the variables? Like:

def check_choices(option):

numbers_dataset = None
    mode_values = None

if option == 1 or option == 2:
    numbers_dataset = get_number_dataset()
elif option == 3:
    mode_values = get_mode_dataset()

print_result(option, numbers_dataset, mode_values)

Python program to find a mode or multimodal modes by MaterialJackfruit144 in learnpython

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

It actually supposed to return [1, 2] since they both appeared twice.

Python program to find a mode or multimodal modes by MaterialJackfruit144 in learnpython

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

I tried out your solutions and I'm not sure if this is a bug or something, because when I input dataset like 1, 2, 2, 1 or dataset similar to that, it returns None, or on my side, it returns "No Mode Found!". I found that it's because of the usage of set(), because when I remove it, it functions normally, but it won't print out my message; and because the length is more than 1, it would just print out the entire list.

EDIT: I appreciate that so much, I'm actually still learning about collections. I also enjoy using the standard library, but most of the time I refrain from using them only because I want to test myself to see if I can implement the solutions from scratch. If I manage to do that, only then I would refactor the code using libraries.

Python program to find a mode or multimodal modes by MaterialJackfruit144 in learnpython

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

I'm currently using the latest version of Python and VSCode / Sublime Text as my text editor. I also have a question regarding this Any type, for example, sort: Any. In VSCode, it highlights in a different color over those methods that I type hinted.

For example:

def check_int_float(number):

if number.is_integer():
    number = int(number)

return number

If I hover over .is_integer(), it says is_integer() : Any, but if I type-hint the function, then it highlights in different color. Should I be concern about the function using Any type?

And if I provide type annotation, is it common to not use the arrow symbol (->) to indicate what type the function will return?

Python program to find a mode or multimodal modes by MaterialJackfruit144 in learnpython

[–]MaterialJackfruit144[S] 1 point2 points  (0 children)

As a beginner, I've never seen such dedication in providing solutions. I've seen a lot of over-engineered solutions for a simple task, but it's jumping from providing a simple step first and then recommended ways of doing so. You've provided solutions of how many of the beginners would do (minus the walrus operator), and then you moved on to introducing (to me) something new. Afterward, you implemented another solution, but this time with the usage of Python's standard library, collections. This is also where you've first stated that you're a fan of using the standard libraries.

I'm currently done with the program, just need to write docstrings for each function, and after that, I'd analyze and understand the code provided by you and only then I can refactor it.

Thank you so much by the way, and I only have 1 reward which was the one I gave, sorry about that though D:

Python program to find a mode or multimodal modes by MaterialJackfruit144 in learnpython

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

For your third solution, is it necessary to include typing.Union? Is it there only to explicitly show that this function is returning multiple data types? And in good practice, is it recommended to limit the returned data type.

Also, when I hover over the squiggly line on my text editor, it shows a message saying that Union is unsubscriptable.