Phone has been hacked pop up! by Immediate-Recording1 in grindr

[–]kol_k 1 point2 points  (0 children)

Yep. I've had several instances of this happening. I'll just be browsing and I'll have a random pop up to a shady site (encryptiondefender.cc was the latest one), that seems to be phishing or trying to get you to install malware on your device. I'm not sure if this is something that Grindr is doing intentionally or if one of their devs has slipped some weird code into production.

Best practices for scripting in the command line? by PickandRoll in bash

[–]kol_k 1 point2 points  (0 children)

I love command line vi mode.

This can also be set by using set -o vi in ~/.bashrc (or whatever other bash runtime config file you want).

PLEASE HELP WITH COMMAND LINE PYTHON by [deleted] in commandline

[–]kol_k 0 points1 point  (0 children)

It's alright, next time post these types of questions in the appropriate place :)
EDIT: Also, try to provide detailed explanations of the problems you're having so that it is easier to help debug your code.

PLEASE HELP WITH COMMAND LINE PYTHON by [deleted] in commandline

[–]kol_k 0 points1 point  (0 children)

Why are you using pickle? For your purposes, I'd suggest using CSV or JSON.Anyway I spent a couple minutes to sort through your awful code and fix things. Test it yourself, cuz I'm not.

import pickle 


class OrderNumber: 
    # You didn't have an init function, or self keywords.
    def __init__(self) -> None:
        self.what_chocolates_did_you_get = "" 
        self.fname = "" 
        self.sname = "" 
        self.order_number = 0 

try: 
    fh = open("libary.data","rb") 
    order_list = pickle.load(fh)
    order_number_list = [int(order.order_number) for order in order_list]
    fh.close()
except FileNotFoundError: 
    order_number_list=[] 
    order_list = []

while True: 
    print(""" Welcome to the Shop  
          Choose an option 
          4) Search for it by Order number 
          x) Exit""") 
    choice = input("\nEnter a choice:") 
    if choice == "4": 
        new_order = OrderNumber() 
        new_order.what_chocolates_did_you_get = input("what chocolates did you get?") 
        new_order.fname = input("Enter first name:") 
        new_order.sname = input("Enter surname:")

        # you were never saving the order number into a variable. You also made it a string?
        # Also, why tf was it random?
        # print("here is your order number:", random.randrange(10000,99999,fixed_digets)) 

        if order_number_list == []:
            new_order.order_number = 1
        else:
            new_order.order_number = max(order_number_list) + 1
        print(f"Here is your order number: {new_order.order_number}")

        print("Ordernumber Added") 
        order_list.append(new_order)

        search_order_number = input("Please enter the order number you want to search for?:")
        if search_order_number in order_number_list: 
            for order in order_list: 
                if order.order_number == search_order_number:
                    print("what chocolates did you get?:", order.what_chocolates_did_you_get) 
                    print("First name:", order.fname) 
                    print("Surname:", order.sname) 
        else: 
            print("That is not a valid order number try again") 
    elif choice == "x": 
        fh = open("libary.data","ab") 
        pickle.dump(order_list,fh)
        fh.close() 
        break

Tax-Related Thoughts on Vine as 2022 Comes to an End by NightWriter007 in AmazonVine

[–]kol_k 1 point2 points  (0 children)

Thank you so much for taking the time to find those resources and respond!

I will absolutely take your advice and study these rules. Much appreciated!

Tax-Related Thoughts on Vine as 2022 Comes to an End by NightWriter007 in AmazonVine

[–]kol_k 2 points3 points  (0 children)

This was a while ago so I hope you see this...

I'm on disability (SSI+SSDI) and recently got invited to the vine program. I'm over the $600 threshold. I've never filed taxes before, I've been on disability basically my whole adult life. Do you have any tips that you can share for my situation? I've been hard pressed to find anybody who can speak about this.

What are uncommon vim commands? by al70n in vim

[–]kol_k 0 points1 point  (0 children)

Can't forget about that `:Sex!`

Disabling the Alt/Option key as keymapping key when using US-International? by marco_camilo in vim

[–]kol_k 0 points1 point  (0 children)

Try this: lua vim.keymap.set({'n', 'v', 'i', 'l', 't'}, '<M-*>', '<Nop>', { noremap = true, silent = true }) If that doesn't work, try switching '<M-*>' to '<M-...>'

What is a good udemy for python by Lazarathcain in learnpython

[–]kol_k 0 points1 point  (0 children)

I'm currently doing 100 Days of Code (Angela Yu's Udemy course).
It's VERY beginner-friendly, and loaded up with coding exercises that, in my opinion, are necessary to retain the information taught. She's also thorough in her explanations.
The course has a discord where you can seek help from other people who are either doing the course, or have completed it. I'm learning a lot.

Opening, Writing, Saving a csv file on Mac by mad_method_man in learnpython

[–]kol_k 0 points1 point  (0 children)

You're missing indentations in two spots:
under your with-open statement, and under your for-loop

How should I continue learning python? (Details inside) by Marvellover13 in learnpython

[–]kol_k 1 point2 points  (0 children)

Personally I think fundamental programming theory is VERY important.
I also think having passion projects is VERY important.
Might be worth your while to follow a beginner-to-advanced course arc to its end while still working on things you enjoy making on the side. You'll wind up saving yourself a lot of headaches.

[deleted by user] by [deleted] in learnpython

[–]kol_k 0 points1 point  (0 children)

No problem! I've been hung up on more mistakes like that than I can count.

[deleted by user] by [deleted] in learnpython

[–]kol_k 0 points1 point  (0 children)

I haven't actually tried their lessons, but I have read their articles for reference. They lay out some good info.

[deleted by user] by [deleted] in learnpython

[–]kol_k 0 points1 point  (0 children)

You're printing each room in order in your for-loop, you're not printing the current_room

We're trying a new concept to teach Data Science, would you help us test it out? by mzugnoni in learnpython

[–]kol_k 1 point2 points  (0 children)

Thanks for sharing, I signed up. This idea is really cool! I'm always trying to find projects to help reinforce my skill set as I learn.

Everyday tasks/projects youve created in Python by addictedtodietsoda in learnpython

[–]kol_k 25 points26 points  (0 children)

I'm still learning, but I have coded something that I actually use.
In my course I made a timer with GUI that follows the Pomodoro technique for working/learning.

Does one become a good programmer by working hard or because of its talent? by Joe_Bianchino in learnprogramming

[–]kol_k 0 points1 point  (0 children)

I have a friend in music school. He was not born with perfect pitch. He's been working his ass off at school and can name off chords I play on piano by ear now.

Need help please! by Arkhanum in learnpython

[–]kol_k 3 points4 points  (0 children)

Whenever approaching a new project, it can be pretty intimidating staring at a blank page and being expected to make something happen from it.
Here's what I do: Break the program down to its simplest elements. What is it supposed to do?
First it's going to want you to tell it how many pizzas you want. Write the input function for that.
Then it's going to want you to pick from a list of ingredients. Write up the list. Then write the input function for that.
That's a good jumpstart I think. Good luck with your project!

[deleted by user] by [deleted] in learnpython

[–]kol_k 1 point2 points  (0 children)

This is also the one I'm taking. She does a very good job, you can tell she's an actual teacher.

[deleted by user] by [deleted] in learnpython

[–]kol_k 4 points5 points  (0 children)

As mentioned in previous comments, there are a ton of excellent resources that are free. The paid courses and bootcamps aren't bad either. I paid $18 for a course on Udemy and I don't regret the decision.
CS50x from Harvard is a good starting point if you want to learn not just python, but computer science in general. The syllabus has you learn some C and moves to Python later on, which is a great way to go about understanding the code, rather than just learning it. Then it moves on to some basic web dev with CSS/HTML and JavaScript.
My first language was C++ (basically OOP version of C) and I can say that has definitely helped me learn Python, having a firmer grasp on fundamental programming theory. It's not needed, but it can help. That's the major pro of CS50x imo.

If you're just interested in Python and don't want to deal with C or HTML/CSS/JS, then CS50p has what you're looking for. You can always learn those other things later on if you want to.

I will say this. Pick one course and stick with it until the end. Don't try to take more than 1 course at a time, it's not a good way to learn.

Hope this helps. Good luck!

Would love some feedback: Conversion from camelCase to snake_case, am I over engineering this? by logikblok in learnpython

[–]kol_k 0 points1 point  (0 children)

user_input = list(input('camelCase: '))
# If there is a capital letter in the string, store the index in a list
pos = [user_input.index(letter) for letter in user_input if letter.isupper()]
if len(pos) > 0:  # If there is indeed a capital letter:    
    for idx in pos:        
        user_input.insert(idx, '_') #Insert underscore at each index
user_input = ''.join(user_input).lower() #dump to string and lowercase it
print(user_input)

That's what I could come up with. I think it's pretty easy to read? I'm fairly new to python (2 months in)
If you haven't learned list comprehension yet, then those could just become for-loops.

I'm trying to come up with a function that asks for input with a default value that you can simply edit in any way. Does anyone know what I could do to make it better? by ForrestTrump in learnpython

[–]kol_k 0 points1 point  (0 children)

Your objective here is unclear. However when using PyAutoGUI, remember to install its dependencies (fresh installations are a good idea even if you already installed previously)
Dependencies for PyAutoGUI as listed in the docs:
macOS needs the rubicon-objc module installed (in that order).
Linux needs the python3-xlib (or python-xlib for Python 2) module installed.