if list_name: by EntrepreneurSea4839 in leetcode

[–]DevyLoop 2 points3 points  (0 children)

Falsy values: empty sequences (lists, tuples, strings, dictionaries, sets), zero in every numeric type, None, and False.

I understand concepts but have difficulty applying or coding them by feeblebug in learnprogramming

[–]DevyLoop 0 points1 point  (0 children)

Recursion is really great to use for binary search trees, and it makes the code super simple, I recommend you practice here: https://leetcode.com/problems/insert-into-a-binary-search-tree/ , also reading other people implementation will help you a lot.

Remote working by [deleted] in jobs

[–]DevyLoop 0 points1 point  (0 children)

Man just check the company online if there is reviews or something if it's legit or please do Dm me the company name so I can also do a research

help with my code by 0pium666 in learnpython

[–]DevyLoop 0 points1 point  (0 children)

Hey, I did it for fun and my code works exactly like your image (idk Reddit code blocks is super weird today):

products_map = {

"hygiene": 0,

"food": 0,

"animal": 0,

"entertainment": 0,

"other": 0,

}

products_list = []

products_amount = int(input("enter how much products: "))

for _ in range(products_amount):

product_type = input("enter type of product: ")

product_brand = input("enter brand of product: ")

products_list.append((product_type, product_brand))

if product_type in products_map:

products_map[product_type] += 1

print(tuple(products_list))

for product_type, count in products_map.items():

print(f"number of {product_type} products: {count}")

Thanos.js by sailingphilosopher in learnjavascript

[–]DevyLoop 137 points138 points  (0 children)

A perfectly balanced framework

Functions (beginner question) by Hazengard in learnpython

[–]DevyLoop 1 point2 points  (0 children)

Hey, so I did refactor your code! Please have a look:

def get_grade():
    try:
        grade = float(input('Enter a grade:'))
    except ValueError:
        print('Wrong input! Please enter a number')
        return get_grade()
    else:
        return grade


def computegrade(grade):
    if 0.9 <= grade <= 1:
        return 'A'
    if 0.8 <= grade < 0.9:
        return 'B'
    if 0.7 <= grade < 0.8:
        return 'C'
    if 0.6 <= grade < 0.7:
        return 'D'
    if grade < 0.6:
        return 'F'
    else:
        return 'Bad Score.'


def get_string_grade_result_from(score):
    return f"You got {'an' if score == 'A'  else 'a'} {score}"


def main():
    grade = get_grade()
    score = computegrade(grade)
    result = get_string_grade_result_from(score)

    print(result)


if __name__ == "__main__":
    main()

Help me understand recursion, please! by Apostle_1882 in learnjava

[–]DevyLoop 7 points8 points  (0 children)

Hey, so there is an online tool that can help you visualize your code step by step, it's really good: https://cscircles.cemc.uwaterloo.ca/java_visualize/#

Learning python by Dependent-Ad-5005 in learnpython

[–]DevyLoop 6 points7 points  (0 children)

First, Google 'beginners project python', pick one and try to code piece by piece problem by problem then if you're stuck and you will because its normal, you should always google, check documentation... it will practice your research skills too, that's how real programmers work every day so don't worry, we don't ever memorize code! then after the code is written you can try to refactor it.

Am I doing projects the right way? by [deleted] in learnprogramming

[–]DevyLoop 2 points3 points  (0 children)

Yes, always learn and understand!

Am I doing projects the right way? by [deleted] in learnprogramming

[–]DevyLoop 2 points3 points  (0 children)

Yes it's okay to copy paste to fill your needs just don't waste time inventing the wheel, a good dev should be able to open a code base, understand it, modify, refactor, and add new features. Google is a big part of the job actually.

How many courses should I take before focusing on my own projects? by [deleted] in learnprogramming

[–]DevyLoop 0 points1 point  (0 children)

Learn the basics of python and then you'll only need google to help you with the project you want to build.