instruction stringlengths 71 95.1k |
|---|
I have a working string indexing method in Java and did convert in Kotlin.
All methods shown below produce the same result but as I am really new to the Kotlin language I wanted to ask which of my two Kotlin implementations is semantically "more equal" to my Java code.
Here is my Java code where "copiedList" is an Arra... |
I'm trying to build a nav, but the way I currently have the data setup I'm having to map within a map with a map to get all of my data out - I have a feeling that this is a poor way of doing something and there may be a better solution?
My code can also be found in a codesandbox here
Both the data and jsx are up for de... |
I have the following code in JS (using last ES2020), the current code check if the type is 'asporto' or 'takeaway' and adding to current date hours from a setup fo type 'takeaway' or 'asporto' and if another setup called limiteOreTakeaway/Asporto is !== '00:00:00' I have to check if the current time is greater than the... |
I previously asked how can I simplify a validation process:
How can I simplify this JQuery validation process?
But in hindsight, what I really meant to ask was how can I turn that process into a reusable function.
I'm going through some old code that I wrote, and I am trying to clean it up so there's not a lot of redun... |
I have updated my previous code with the suggestions. I have also implemented concurrency to speed up the results.
I'd be interested for comments on a more efficient use on concurrency / parallel processing / hyper-threading
import concurrent.futures
import hashlib
import time
def make_next_guess(guess):
carry = ... |
I created the following service for the purpose of sending in a file for parsing. I'm using the generics so that when I call parse() I can pass a custom type conforming to Codable. I'm not a huge fan of the repetition of do {} catch {} but I don't see any other way to avoid this.
import Foundation
enum JSONError: Erro... |
The code I'm working on looks like this - All the way up to 50... (Not ideal)
There can be anywhere from 1 to 100 anchor/div combinations, but more often than not in single digits so there's almost always a lot of redundant CSS rules.
I was wondering if there was a better way to write the CSS / SCSS for this rather tha... |
This question is a follow up to my previous question, link to the post can be found here. I really appreciate the reviewers especially @Edward's review. They highlighted great points which were considered whilst refactoring the codebase.
OVERVIEW
This project is a console-based quiz application. It can be constructed f... |
I'm new to C and programming in general (some minimal prior exposure to JS and python). This is also my first time working with shell commands, scripts, and cron. This program works on my macOS and Lubuntu running on a VM (so long as you run as root).
Using this program, you can set times throughout the day when your w... |
I have a method that received a list of CoordinateBE : setExits(..)
I want to update the existing coordinates list with a new coordinate only if there is no coordinate in the current list that has the same latitude and longitude.
Example:
List: [Coordinate: lat:23, long:24, Coordinate: lat:34, long:24]
I am trying to a... |
I'm a new self taught "programmer" that has been given the task at my job to parse through generated .txt test records and insert the data into a database. Usually when given a task like this I just hack together something that works, but I want to get better at creating smarter code.
Basically, the program generates a... |
I'm relatively new to programming and I was trying to work a project.
I would like recommendations of how to annotate or comment my project and any improvement I could make to it, any suggestion is welcome,
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import javax.xml.parsers.Docum... |
I am solving a problem for Hackerrank where I have to count the number of palindromes in a given string.
I have the following code which counts the number of palindromes accurately but times out for large strings. How do I make the code more time-efficient?
def countPalindromes(s):
num_palindrome = 0
for i... |
This is a pretty simple working example using React-Redux to select a user from app.com/user/:userId and then fetch/display that user's info from a remote API
Most of the examples/code I can find online use class-based components but since I already have part of a project written using a functional approach I'm looking... |
This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++. Thanks to Quuxplusone's answer and G. Sliepen's comments. Based on the mentioned std::vector<std::vector<std::string>> case, it indicates a problem about the process of unwrapping nested iter... |
This code is a revised version of implementation which asked for a advice. Original question is here: Encode message by alphabets
#include <stdio.h>
#include <stdlib.h>
#define MIN_ALPH 1
#define MAX_ALPH 26
unsigned int my_decode(unsigned int input)
{
unsigned int count = 0;
unsigned int ddigit;
int i;
... |
I have written some code to solve the following interview question. Please advise how it can be improved. Thanks in advance.
A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. Given the root to a binary tree, count the number of unival subtrees.
For example, the f... |
I have two lists of dictionaries where both have the same "id" key but otherwise different data.
list1 = [{"id":1, "spam": 3, "eggs": 5}, {"id": 2, "spam": 5, "eggs": 7}]
list2 = [{"id":1, "knights": 5, "coconuts": 2}, {"id": 2, "knights": 3, "cocounts": 8}]
I know I can do a nested loop something like this (I know I ... |
What I try to achieve
I need to create a administration-panel for a website. Therefore, I need a possibility to protect the content of the panel via a password. The functionality doesn't have to be very advanced. I neither need a password-reset functionality nor the possibility to add more than one user. I also don't n... |
Finally after a few months of searching and learning AJAX with pagination PHP and History.pushState() I created AJAX PHP pagination.
Test page
1. Ajax(index.php)
$(window).on('load', function () { // makes sure that whole site is loaded
$('#status').fadeOut();
$('#preloader').delay(350).fadeOut('slow');
});
... |
I am writing a piece of code for some students and I came up with the following implementation of Floyd's algorithm for finding cycles in linked lists.
I was wondering if there are ways I can improve what I have so far such that the result is
more C++ idiomatic
does not contain dumb mistakes associated with the generi... |
quick question. I'm using Spring Boot and I created e.g. this class
public interface ProductService {
Page<Product> getPage(Pageable pageable);
}
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductRepository productRepository;
@Override
public Page<Pr... |
Background
In the field of optimal control, it is part of everyday business to solve ordinary differential equations numerically. A differential equation system or dynamic system describes e.g. the physical behavior of an object over time. Every single equation can often be associated with a special state (position, ve... |
I need to find the odd occurring numbers as a list. For example the below list should give 1 and 2 as output.
Is there a way that I can do it in a better way?
ArrayList<Integer> numbers = new ArrayList<>(Arrays.asList(1,2,2,4,2,4));
List<Integer> OddOcuranceNumbers =
numbers.stream()
.collect(Collectors.groupingBy(Func... |
UPDATE: After getting "a kind of" affirmation from various platforms( my discussions on twitter, reddit, other stack overflow posts,etc) I have written an article on this style of view binding. Kindly check that out too, as that's the only place i am currently updating my latest version of the code (It's not behind t... |
I have the following implementation that takes in symmetric matrix W and returns matrix C
import torch
import numpy as np
import time
W = torch.tensor([[0, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 3, 0, 0, 0, 0, 0],
[0, 0, 3, 0, 1, 0, 0, 0, 0],
... |
I had an idea recently of simplifying some of the code I already have in my Android app that uses Kotlin. I somewhat new to Kotlin, so any opinion would be very appreciated.
Before giving you what idea I had, I will give a base example of what code I have right now:
Lets say that in my app I have a functionality for us... |
I work with the GoogleMaps API, using React.js.
Inside the GoogleMap component:
I have a component called UserLocationTimer, which activates
setInterval within useEffect and samples the user's location every 2
seconds, centering the map accordingly. In addition, returns the
UserLocation component that displays the mar... |
My adjacency matrix looks like this, where non-zero weights denote edges.
[0, 2, 0, 0, 3]
[2, 0, 2, 4, 0]
[0, 2, 0, 3, 0]
[0, 4, 3, 0, 1]
[3, 0, 0, 1, 0]
Here's my attempt, would appreciate a code review.
private static class Edge implements Comparable<Edge> {
private int source;
private int destination;
p... |
I have this Java solution to LeetCode's 3Sum problem.
I would be really grateful if I could get feedback on correctness, scalability, efficiency, coding best practices, and OOP design.
I'm relatively new to Java.
class Solution
{
public List<List<Integer>> threeSum(int[] nums)
{
List l1 = new ArrayList<... |
As you might know, EF Core does not support executing multiple queries in parallel on the same context using something like Task.WhenAll.
So you have to write this code instead:
using var context1 = _factory.CreateDbContext();
using var context2 = _factory.CreateDbContext();
using var context3 = _factory.CreateDbContex... |
Can this code be shortened, optimized or remove any unnecessary parts. Just curious if this is the right way to achieve the given result in this CodePen example: CodePen Connect Four
Here is my code:
// Debug & fix this Script..
document.addEventListener('DOMContentLoaded',()=>{
const displayCurrentPlayer = do... |
I've recently started learning rust and doing cryptopals as exercise.
I coded a program that decrypts single xor cypher. The algorithm I came up with is very simple and probably not efficient, but I would like more emphasis on rust philosophy and syntax
extern crate hex;
use std::collections::HashMap;
fn main() {
... |
Data Structure coming back from the server
[
{
id: 1,
type: "Pickup",
items: [
{
id: 1,
description: "Item 1"
}
]
},
{
id: 2,
type: "Drop",
items: [
{
id: 0,
description: "Item 0"
}
]
},
{
id: 3,
type: "Drop",
... |
I'm coding a random strings generator. It's working, but I'm not sure if this is efficient.
/**
* @param n total number of strings to generate
* @param length length of generated strings
* @param charsetStr charset to be used when generate
*/
public static List<String> generateRandomStrings(int n, int ... |
I wrote this a few months ago as my first "serious" C program (I've used JS for a few years). It's a simple resource collecting and trading game (based off one I made in HTML/JS), that takes input in the form of some simple commands.
#include <stdio.h>
#include <inttypes.h>
#include <math.h>
#include <string.h>
#includ... |
First and foremost I want to say that I'm fully aware GOTO should normally be avoided in production code and it tends to be unreadable for others. For this specific case however, the code will not be read by anyone but me and the question is being asked mostly so I can understand what other options do I even have avail... |
I'm making a command line interface (CLI) role playing tool that tracks the state of the world, storing characters, monsters, etc as text files so their data can be edited directly if needed (free Vim UI yay). This means that every game loop, I need to reload the files.
Note: Direct editing implies no pickling. Also, I... |
I have been practising Python Practice questions and came across this question:
Write a Python program to add 'ing' at the end of a given string
(length should be at least 3).
If the given string already ends with 'ing' then add 'ly' instead.
If the string length of the given string is less than 3, leave it
unchanged.... |
I apologize beforehand if the question has been repeated so many times. This is a practice task from Automate the Boring Stuff with Python. In brief, the task entails writing a code that carries out an experiment of checking if there is a streak of 6 'heads' or 'tails' in 100 coin tosses, then replicates it 10,000 time... |
This is a simple program that solves a given Sudoku puzzle recursively. The input is provided as a file that contains the cells, 0 if empty, delimited by a , character.
#include <iostream>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include <utility>
#include <exception>
#include <fs... |
I am using OWIN to self host a WebAPI service. There is Unity to serve as an IoC container. Within several OWIN middlewares (e.g. authorization layer) as well as in WebAPI I need to access a Unity container to resolve my dependencies. There should be a single child container per each request so that there is for exampl... |
To compare the speed of Julia to Python+numba, I implemented Game of Life in both languages.
For anyone who is not familiar with Game of Life: Start with a matrix of boolean entries, encoding whether a cell is alive or dead. Then, at every iteration, update the state of a cell based upon its value and the eight neighbo... |
I have this piece of code:
final ResultDO response = transformJsonToResponseDO(rawDataResponse, ResultDO.class);
return Optional.ofNullable(response)
.map(results -> createPOIs(Collections.singletonList(response), providerResponse))
.orElse(Collections.emptyList());
The important part is that:... |
I created this hangman game today as my first stand alone project. It is a quite basic and simplified approach. How could I improve the game to make it more interesting?
import random
words = ["abductions", "abridgment", "admixtures"
,"backfields", "blueprints", "chivalrous", "complexity", "cyberpunks", "de... |
Link here
I'll include a solution in Python and C++ and you can review one. I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review Python code. Both solutions share similar logic, so the review will apply to either.
Problem statement
Given a s... |
Weekly Employee Report Generator PowerShell Script
Description
This script is used for generating a Markdown template file for weekly employee reports. In Settings.cfg file you can define the name and title of the employee, report title and report folder name, starting hour and working time, and the names of the days o... |
I recently was reading an article labeled "Modern C++ Singleton Template". The proposed solution used C++11 feature of Magic Statics (N2660). I wanted to adapt it for an own project in
"freestanding" (fno-hosted) environment.
My code looks as follows:
Singleton.hpp
namespace std
{
template <typename T>
class Si... |
I have an Excel file with 2 columns, names and numbers. I want to know for each name what is the probability for each number. I prefer to do it in Java so I would be able to combine it with the rest of my project.
Actually, I already did it, and it's works, but I think it's done in a primitive and inefficient way.
Can ... |
Link here
I'll include a solution in Python and C++ and you can review one. I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. Both solutions share similar logic, so the review will apply to any.
Problem statement
Determin... |
This function takes a list/array of booleans and converts them to an array that counts the number of either True/False values found next to each other.
I'd like to see this optimized for performance. It's not too slow, but I do use multiple loops with embedded if-else statements, I'm wondering if they're absolutely nec... |
Background
I am currently participating in a tic-tac-toe coding challenge. During their move, each participant is given the board state and their team, X or O. The blank board is:
[[' ',' ',' '],[' ',' ',' '],[' ',' ',' ']]
With 'X' and 'O' being added to the board, for example:
[[' ',' ',' '],[' ','X',' '],[' ','O'... |
This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A recursive_count_if Function with Specified value_type for Various Type Arbitrary Nested Iterable Implementation in C++. After digging into the thing that detecting the argument type of a... |
This is an object-oriented Chess game. So far, I have implemented the pawn and board functionalities and I would love to get a review early on before diving deep into the project.
piece.py
# piece.py
from abc import ABC, abstractmethod
class Piece(ABC):
def __init__(self, color):
if color.lower() != 'bla... |
Inspired by another Q I finally made a version that groups permutable regions into parentheses. Non-ambigous sequences are outside of parens.
Here the original problem:
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message,
count the number of ways it can be decoded. For example, the message
'111' would g... |
I'm working on a project where I need to get all followers from a specific user and store this info in a database. I have done this and so far it suits my needs, but I'd like to make it more "professional" and would love to hear your suggestions.
The first code is twitter.py and the 2nd one is app.py
import requests
c... |
I have a table that has buttons per row that makes views/edit an item in a modal and they have a layout like so:
<td>
<button class="btn btn-sm btn-default" onclick="setModalMode('view', '8')" data-toggle="modal" data-target="#license-add" data-id="8">
<i class="far fa-eye"></i>
</button>
... |
So I'm learning typescript and I'm making a simple functional PubSub system. I want the user to be able to define topics and the data for those topics. So far I've got the below code, but I really want to improve it.
I'm not sure if I can get rid of the unknown in <T extends Record<string,unknown>>. I don't think that'... |
This is my code for an assignment. The task is to take a user input in form of a sequence of parenthesis' followed by an E to mark its end and determine whether it is a correct sequence (as an example (()())E is correct, )(()((E is incorrect) and if incorrect determine how many parentheses at the start you need to remo... |
I'm trying to optimize my solution to the following question:
given a regular expression with chars and special char '*', (star which is a joker we can replace with any string), and a string, write a program which determines if the regular expression can represent that string or not.
for example: "a'*b" can represent ... |
Hi I coded a simple app that allows user to generate border radius and then copy it to clipboard.
I already found out how big is the impact from your reviews guys. My code is slowly improving.
If someone could point out mistakes etc. in my code I would be grateful.
Repo on github
HTML:
<!DOCTYPE html>
<html lang="en"... |
We have two physical AWS S3s called in the code s3Legacy and s3Cache. They store the same data but with different S3 key structures.
The fists solution shared below uses objects, the second does not.
Is the solution using objects an excessive abstraction or there are benefits to it?
(There is no need to comment on the ... |
New to Python/Selenium and learning on the fly with my first basic selenium script.
Request user input - activate or deactivate.
Open's website, loops through shop URL as well as activate/deactivate checkboxes.
Would be grateful for some feedback on how to optimise the code.
# IMPORTS
import time
from selenium import w... |
I tried to code the fizzbuzz program following the functional programming rules in javascript. Please check my code and give feedback. thank you.
const isDivisible = (number, fizz) => number % fizz === 0;
const getSubstitutes = (
number,
substitutes,
{ currentIndex = 0, result = "" } = {}
) => {
if (currentInde... |
Some friends and I were playing a board game and decided that the random dice rolls just weren't fair! So we came up with a scheme for making the rolls slightly more evenly distributed, and I implemented it in python. The class represents 2 six sided dice and makes the probability of a given combination coming up (ther... |
I have a solution to this CodeWars challenge that's being rejected as "too slow".
Basically, write public static BigInteger Fusc(BigInteger n) given:
fusc(0) = 0
fusc(1) = 1
fusc(2 * n) = fusc(n)
fusc(2 * n + 1) = fusc(n) + fusc(n + 1)
-- CodeWars description (from part 1, which is formatted slightly nicer IMO)
I h... |
I want to improve on my original solution to this problem,
my solution is O(n^2) and I think it's possible to solve in less time
You have two arrays: A and B. A contains ints and B has pairs: (element from A, the number of elements that are larger than that element and to the right of it in A).
for example:
A = [4,3,5... |
I tried to implement bubble sort in Assembly 8086.
datasg SEGMENT BYTE 'data'
array DB 1, 3, 2, 5, 4
n DW 5
datasg ENDS
stacksg SEGMENT BYTE STACK 'stack'
DW 12 DUP(?)
stacksg ENDS
codesg SEGMENT PARA 'code'
ASSUME CS:codesg, DS:datasg, SS:stacksg
MAIN ... |
I have an assignment that I have completed, but I feel as though the way I went about solving the problems could be optimized a bit. As well, I don't know if I'm properly utilizing return statements. I'm relatively new to coding so I don't have the knowledge, but I would love to learn if anyone wants to go through and ... |
I am making a Ping Pong game using Html5 Canvas. I am concerned about the movement(_b) method. This method should move the computer paddle (up and down) vertically and follow the ball. Some sort of simple AI. Everything works like it should but there is a lot of repetition of if else blocks that might be handled differ... |
I am working on a small project that requires finding Von Neumann neighborhoods in a matrix. Basically, whenever there is a positive value in the array, I want to get the neighborhood for that value. I used an iterative approach because I don't think there's a way to do this in less than O(n) time as you have to check ... |
I've been programming in Go and I enjoy how easy it is to create descriptive errors and propagate them up the call stack. I wanted that sort of ease and consistency in C so I created a small error handling library to propagate errors and generate a sort of error code stack trace.
I've been using C for 6 months so I'm n... |
This project is in chapter 5 introduced me to a whole new world of dictionary data structure. To put it briefly, I want to know whether the choice I took between lists, tuples, and dictionaries could've been justifiable calls or not. I'm also not that confident about where putting many return statements correctly and m... |
I had a task where I had to build a stamp duty calculator, which calculates the tax or stamp duty first-time buyers(ftb) returning buyers (rtb), and second-home buyers (shb) had to pay when purchasing the home.
These were the tax bands, although I think some of the percentages may be slightly wrong.
First Time Buyers
0... |
This is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++, A recursive_count_if Function with Specified value_type for Various Type Arbitrary Nested Iterable Implementation in C++ and A recursive_count_if Function with Automatic Type Deducing from La... |
I have the following problem and I am new in Java:
I have an initial capital of 10 000. I invest this initial capital of 10 000 in the bank for a interest rate per month of 0.04/12. My net income is 3000 per month and my expenses per month is 2000. I invest also my monthysavings = net income - expenses = 3000 - 2000 = ... |
I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.
Here is my code:
BITS 16
start:
mov ax, 07C0h
add ax, 288
mov ss, ax
mov sp, 4096
mov ax, 07C0h
mov ds, ax
mov si, text_string
call print_string
jmp $
text_string db 'OS', 0
... |
Story
I'm trying to become more familiar with template metaprogramming and practice more of it. I need to use modular arithmetic to solve certain problems and so I decided to write a general purpose template for it.
Code
Include files
// Individual
#include <iostream>
#include <chrono>
#include <vector>
#include <excep... |
I have some vanilla JavaScript for a website menu which works perfectly (thanks mainly to Titus on Stack Overflow), opening and closing a sub-menu (toggling <ul class="hidden"> ) if the UL's sibling button is clicked or closing the sub-menu if another button on the same level as the sibling is clicked, adjusting other ... |
im trying to migrate my very large swift view controller to mvvm but it still feels very large, can you guys give me any advice
What this controller does is simple it shows a UIView on which i can draw the buttons that I display are here to manage the lines that i have drawn on the canvas.
For example to delete the las... |
Initial version of the code appeared as an answer to an SO question. I refactored the code a bit and it works pretty well, IMHO. I get a solid .csv file with all the data from Texas Department of Criminal Justice's Death Row page.
What I was especially interested in was getting all offenders' last statement, if there w... |
My C program has to parse a fixed-length message like this:
uint8_t message[8] = {80, 75, 73, 71, 1, 1, 1, 1};
another message could be:
uint8_t message[8] = {80, 75, 73, 71, 41, 42, 1, 1};
The message contains an ASCII string and 1 shows the end of string. So the actual length of the first message is 4 and the secon... |
Here is the code that can be used for calculation of mathematical function, like ax^2 + bx + c.
It is fast enough if you choose small length, otherwise if programmer don't know the small range, that code can be really slow. I've made it specially on C++ to be more fast.
#include <iostream>
#include <vector>
using name... |
I'm trying to solve a skyscraper puzzle for 6x6 boards using constraint programming and then backtracking. My solution works but is too slow, for certain cases, it takes up to 2 seconds and I was wondering how I could reduce this.
Here is the structure of my algorithm:
Create board of N size with each element having i... |
I often find that when I am writing, refactoring, or reviewing code that I want to do some simple testing. There are many existing test frameworks such as gtest and cppunit but my desire was to create something much simpler and with fewer features.
Specifically, I have two use cases in mind:
I have some test input va... |
I am trying to build a simple algorithm to achieve the best combination of values based on two params in an array of objects.
The whole code is available here
First I have an array holding objects. The items which will be analyzed and packed into volumes together. All of the values are in percentages.
const nonStackabl... |
I have a very basic python script that reads a CSV file. I'm importing the csv module setting some empty list variables and getting the data I want. The problem is that I know there is a much more efficient way to get the data I just don't know how to do it and I feel very redundant in creating a reader object multiple... |
I have 7000 CSV files that I want to do operation on. but the problem is that it takes to much time like it takes 13 seconds to process these files.
What I need to know is which operation take more time.
Opening and closing the files?
Reading data from these files?
I want to convert this program into multithreading o... |
I have two csv files, pricat.csv which contains objects I need to populate my DB with, and mapping.csv which specifies how the value in pricat.csv must be displayed in my DB, for ex: 'NW 17-18' in pricat.csv has to be 'Winter Collection 2017/2018' in my DB. Here the csvs, first row in both are the headers:
ean;supplier... |
I am learning typescript with React and come up with this small program that each button count how many time by clicking and record which button got click. Please help me to take a look if all the code are the best practice.
import * as React from "react";
import "./styles.css";
interface ButtonContainerProps {
opti... |
I did a small countdown clock challenge in JavaScript. Please review it, thanks.
const timeControls = document.querySelector('.timer__controls');
const timeLeft = document.querySelector('.display__time-left');
const endTime = document.querySelector('.display__end-time');
let interval;
function secondsToHourMinSec(se... |
I am trying to create class with connect to mysql database. And if there is max number of connections I want to wait and try it again. I figured out, how it can works, but I am not sure, if its the right way of doing it. So, my code looks like this:
<?php
class DbConnect {
private $attemps = 1;
private $errorCode... |
I must create a function that accepts a string of names all separated by a comma.
Example: "Jack,Matthew,John,Sam"
And return the string of names in the same order but spelled in reverse.
Expected output: "kcaJ,wehttaM,nhoJ,maS"
I completed the function with an inner for loop but I would like to know if maybe running a... |
I just wrote this decimal to Roman numeral converter, inspired by Kevlin Henney's talk "Get Kata".
I have been reading the Rust docs little by little and this is one of my first attempts at some code.
I'd like to get feedback on style, general rust idioms and how I could have implemented this algorithm in a more succin... |
I have created a Reddit bot that goes through an "x" amount of posts. For each post it pulls all the comments from that post into a list then a data frame and then it loops over a CSV look for words that match a ticker in CSV file and then finally it spits out a sorted data frame.
is there anything I could improve / mo... |
So I am building a website. It will be only used inside our small company and it's not made for public use.
What I want to achieve is the ability for user to maintain session after sign in for a prolonged period of time while also maintaining some sense of security and common sense.
My website building experience is 2-... |
this is my 2nd project on Python. I created a game of Noughts and Crosses(Tic-Tac-Toe) that you can play against the computer. What are your thoughts on my implementation of the game? Is there anything I've missed or could improve upon?
I did think about adding a figure window and making it more interactive by clicking... |
Implementation is based on the MVC design pattern, with callbacks to allow model and view to communicate with controller.
Concerns:
It's not ideal to have async code inside the model, i.e the model should be as close to a basic
hashtable implementation as possible. However since we need to set a chain of calls to the v... |
Here's the code I'm having trouble shortening. I am currently a beginner in Python 3.x.
from os import system
def fibonacci(terms):
count = 0
x = 0
y = 1
z = x + y
if terms <= 0:
print("Enter a positive integer.")
elif terms == 1:
print("Fibonacci sequence in " + str(terms) + " ... |
This is a follow-up question for the previous questions about recursive functions, including A Summation Function For Arbitrary Nested Vector Implementation In C++, A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++, A recursive_count_if Function with Specified value_type for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.