Skip to main content
Advice
4 votes
14 replies
245 views

I currently have a block of code looking like this: if (StateA) { DoSomething(); } else if (StateB) { DoSomething(); DoSomethingElse(); } I was thinking there must be an elegant way ...
lenny's user avatar
  • 793
-1 votes
1 answer
41 views

I've applied for the Luau role on the HiddenDevs website five times, but I keep getting rejected. I'm feeling really frustrated and would love some guidance on how to overcome this obstacle. Each time,...
yousef mashayekh's user avatar
0 votes
0 answers
24 views

Good day, I'm trying to improve my OOP competence and trying to create a code to generate a single window(gui) which hold n checkboxes based on the files the code finds in a specific folder. The idea ...
John Smith's user avatar
0 votes
2 answers
93 views

Im currently trying to optimize my code for readability and have run into issues when I'm indexing an array but also need to use negative number. Here's the example: Example Case Explanation since its ...
Illumin's user avatar
  • 23
0 votes
2 answers
116 views

I'm currently trying to build a string parser for an AVR based stepper motor controller. The idea is to observe some input string over UART, then breaking apart this string into several sub-buffers ...
slurpeecup's user avatar
-2 votes
1 answer
57 views

I'm building a REST api which take some inputs like id,customer_id,firstname,lastname,contact,email,updated_time,created_time. Before processing these inputs, i have added validations to check if id ...
Unnikrishnan KJ's user avatar
1 vote
5 answers
155 views

I have the Enum A, B, C. In a method, I am given two different Enum and must return the remaining Enum. Example: I receive A and C I must return B The solution that I have is to use if elseif else: ...
ATalkingMonkey's user avatar
0 votes
2 answers
350 views

Here is a hypothetical example: I have a market.service.ts with 2 functions called buy() and sell() which are each 100 lines of code export class ShopService { public async buy() { // 100 lines ...
Rahimi0151's user avatar
-1 votes
1 answer
246 views

I was wondering if it is better to use directly "content = {}" parameter instead of "{}" despite I see more often people using "{}". Is the code cleaner or does the code ...
Mister Propre's user avatar
0 votes
1 answer
121 views

I'm trying to create a "pixel" layout and manage movements over there for an exercise, and I would love to know a simple/creative way to name and use all the variables without doing terribly ...
Carlitos Elenor's user avatar
0 votes
2 answers
94 views

I'm learning the basic of Python dictionaries and am having an exercise on nesting dictionaries in a list. It basically told me to make 3 dictionaries about 3 people, nest them inside a list, loop ...
Hazel P's user avatar
  • 17
-3 votes
2 answers
644 views

I'm following a data structures and algorithms course taught in Python at the moment and the instructor always opts to unpack arrays (well, lists) using a range functions (method 2 below) instead of ...
Jonny Studholme's user avatar
1 vote
2 answers
113 views

In C, I am calling many functions having to check if they worked. The code gets ~3x bigger because of it! An example: char *myStr = malloc(sizeof(char)); if (!myStr) return NULL; Is there a more ...
Gabriel Silva Schilive's user avatar
-1 votes
1 answer
519 views

A colourful number is one that includes no duplicates in the list of it digits + the products of the subsets of its digits. For example, the products of 263 are [2, 6, 3, 2x6, 6x3, 2x6x3]. These are ...
Alastair909's user avatar
0 votes
2 answers
592 views

I am trying to import legacy_round from textstat as follows: from textstat.textstat import textstatistics,legacy_round But I get following error: ImportError: cannot import name 'legacy_round' from '...
Donya's user avatar
  • 65

15 30 50 per page
1
2 3 4 5
49