instruction
stringlengths
71
95.1k
I'm currently learning python and created a simple music quiz. the rules of the game are as follows: The user has two chances to guess the name of the song If the user guesses the answer correctly the first time, they score 3 points. If the user guesses the answer correctly the second time they score 1 point.The game r...
As the title suggests, I'm a complete beginner in Haskell. I've just made my way through the "Input and Output" section of Learn You A Haskell For Greater Good and I thought it would be good to try my hand at a simple project like a "Guess The Word" game in Haskell. The idea behind the game is to guess all the letters ...
I now processed the suggestions you can find here. I've deleted some duplications and corrected some other minor mistakes. Here's the code: import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.Dimension; public class caesar { public static void main(String[...
I am trying to solve a codewar challenge (link): Your job is to create a calculator which evaluates expressions in Reverse Polish notation. For example expression 5 1 2 + 4 * + 3 - (which is equivalent to 5 + ((1 + 2) * 4) - 3 in normal notation) should evaluate to 14. For your convenience, the input is formatted such...
I programmed a Neural Network in python. Feedback every kind is appreciated. I tried to use some vectorization but it turned out to become quite a mess. Because you can't append to numpy arrays I sometimes needed to use numpy arrays in list and sometime I could use just numpy arrays. Is there a way to make It look clea...
I have a password validation class that takes values from our database and depending on their values, checks if the password is valid. If it is not, I built an error message containing everything that is wrong with the entered password. I want it to be easy to change when I add a validation attribute in the database. I...
I'm new to TPL Dataflow and was looking for an action block to basically push an object on a timer - specifically to produce heartbeats on every interval. I was unable to find anything out of the box so I decided to create a wrapper class on action block that would give me the desired functionality. I also wanted to i...
Below is an example of a simple converter. In the first example temperature I have used a function within a function. In the second example milli I have used a more direct approach. Which would you consider is the better method to handling calculations in functions and why? Also feedback on my approach and examples of ...
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; th...
I have RGB Images, Depth images and OpenPose Images(generated from RGB Images). The number of RGB and Depth images are different so I have to find the exactly which RGB images corresponds to which depth images. This is done using the time stamp values I have for both RGB and Depth Images. The problem here is this code ...
This is my first big project that I've decided to release publically. It's available on my Github, and through pip3: pip3 install delicioussoda. This is a simple parser for robots.txt files for a website. And yes, the name "DeliciousSoda" is a play off of "BeautifulSoup". As I intended to keep developing and adding mor...
I'm writing a toy vector library in C to learn a bit about the language. The excerpt below shows my vector structure and two functions: vec2_magnitude calculates the magnitude (length) of a vector vec2_unit uses the magnitude to calculate the unit vector #include <math.h> // A fixed-length vector w/ 2 elements. type...
Here is my code: defmodule LineScanner do @spec scan(String.t()) :: [Token.t()] def scan(line) when is_binary(line), do: scan_(line, {[], ""}) |> Enum.reverse() ### The function below needs some refactoring ###### @spec scan_(String.t(), {[Token.t()], binary()}) :: [Token.t()] def scan_(line, {acc, ...
This is a follow-up on Change size of elements until parent reaches certain height The goal of the function is to find a size for the elements inside a parent, so they all fit in a single row. I tried it with a loop (check previous question), and now I changed it to if statements. However I would like to simplify it, b...
The below code is either inserting or updating a list of person with a lot of properties of these persons. The code is repeating itself a lot but is working as intended. Unfortunately making all the types implement a common interface is not an option for me. public void BulkInsertPeople(List<Person> persons, User reque...
i am trying to learn mvc (model view controller). there are many texts out there explaining what mvc is. but not many explaining how to actually code mvc. i found a bunch of questions here asking about mvc. some seem to contradict each other (view observe model or not, controller listens to view or not). i made a simpl...
I just wrote a short function to parse SO jobs XML feed and return dicts containing information about each job entry. Now, each job entry page is visited to grab info not present in the xml feed (company logo URL, salary info, etc.) through bs4 with couple functions in the get_so_extras module. parse_feed.py: from date...
I've implemented the cryptographic method of the Fleissner-grille aka Turning-grille . Here's the code: import java.util.Scanner; import java.util.Random; public class fleissner { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Scanner scanner2 = new Scanner(System...
My professor told me to optimize my perl code, but he wouldn't tell me what exactly - just make it simpler. I changed some little things but nothing major. Am I missing something? The task was: Perl program that allows the user to simulate the simultaneous throwing of several cubes. The simulation result is then a t...
I'm implementing LZ77 compression algorithm. To compress any file type, I use its binary representation and then read it as chars (because 1 char is equal to 1 byte, afaik) to a std::string. Current program version compresses and decompresses files (.txt, .bmp, etc) just fine – size of raw file in bytes matches the siz...
Could you review the approach and let me know if there is a better way to implement the same using different java techniques (also performant)? Requirement as follows: The products that are returned for a request, need to be ranked to offer the most relevant product to the user. we will rank based on weight and then o...
I have this code snippet comparing two slice references: fn compare(&self, a: &[u8], b: &[u8]) -> i64 { let mut p1 = a.as_ptr() as *mut u8; let mut p2 = b.as_ptr() as *mut u8; let mut min_len = cmp::min(a.len(), b.len()); let mut ret = 0; while min_len > 0 { unsafe { if *p1 != *p2 ...
I needed in my project to import .txt files without knowing their encoding, but knowing, they will most likely be in Czech or Slovak language. Sadly there is bunch of possible encodings so I decided to create code, that will try to detect encoding based on content of this ByteArray. Idea is to: Convert all characters...
I am following CIS 194: Introduction to Haskell (Spring 2013) online to teach myself Haskell. Following is my response to third exercise of Homework 3, namely Histogram. In which ways I could improve this, without getting too much into advanced topics of Haskell? {- For this task, write a function histogram :: [Integer...
As you know there is an algorithm in C++ standard library called std::merge, that merges two sorted ranges into another range. I try to write another merge (called multi_merge) that gets multiple sorted ranges (one or more), and merged them in one. The code is as follows: #include <utility> #include <vector> #include <...
I want to write an algorithm to count how many islands are in a given matrix. Consider for example: A = [ [1, 2, 1, 3], [2, 2, 3, 2], [3, 3, 2, 3] ] Directly adjacent (north, south, east, west, but not diagonally) numbers constitute an island, in this example matrix we have 9. I've written...
I have a nested set of for loops which achieves the desired outcome, but I don't know if it is the most efficient / pythonic way of populating this list. I would like all combinations of the one object functions, combined with 0 to n combinations of the two object function. Here, I have abstracted parts of the code awa...
I implemented a general function for a depth-first-search (DFS) using JavaScript with default arguments and functions that need to be provided in order for it to work. This function is using async & await, but both can be removed to make it synchronous. Is the naming sensible? Are there missing pieces that would be us...
I needed a Minecraft-like stone texture, instead of creating it using image editing software I decided to generate one using R. The idea is to create some noise and stretch it horizontally so the texture tends to have some horizontal lines. Example output (this example is upscaled, the original file is 32x32 pixels): ...
I'm trying out .net core with mvc in a personal project, the latest functionality I've added was a project catalog, primarily ajax based, it's displaying a list of projects fetched from the database using web api in a catalogish order and interface. Web API Starting with the infrastructure layer, I decided to have 2 c...
I'm studying with book "Introduction to Algorithms" and implemented PriorityQueue without existed Class. I made a MaxHeap class with Array and made a PriorityQueue with my Heap class. Actually code is working and refactored code I did my best, but I'm beginner so I need feedback for anybody. would you give me a opinion...
I'm new to VBA programming so the following code may look terrible which is why I want ways to understand how to better optimize it and other future codes. Sub Sequence() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Application.DisplayAlerts = False Dim unique_string1, unique_string2...
In my program, I have special id numbers. They have a fixed length of 10 characters and may only contain digits and lowercase letter. I created my own data type for this. I want to be able to assign string values to it (with the implicit operator). When I do so, there should be automatically a verification if all condi...
The challenge is to iterate over the vector only once and return the value within the range of the zero. However, if there are no matches or more than 1 match, deliver an error. The vector is unsorted and has no guarantee on it's size or the range of data. More technically, the number of data accesses into the vector c...
The code below is written as part of a parser, which files would be also added here: XMLParser, parser, Name, GenericElement, attrib It reads an XML files from a folder, turn them into a dataframe using pandas and then parse it into a CSV file. from generic_parser import XMLParser import pandas as pd import os opdatas...
Context: This script reads in a fasta file, counts the number '-' characters, alphabetic characters and total characters for each sequence (sequence descriptions are on lines marked with '>'), and then prints out a processed file with columns where 90% (or more) of '-' characters are removed. I've tested it with small...
I want to remake and sort an array. Is it possible to use "reduce" instead of "forEach" or "map"? return beeProps.valueInfos.reduce (reduce()) would be great. Anything else looks like it could be improved? const makeTableArrayMap = (beeProps: beeOfProps) => { const rowMap: Map<number, beeOfValue[]> = new Map(); ...
I am just starting to code by myself in Flutter. I've built this so far and here is the image. Can you show me what would be better or cleaner code? I used Row widget for it, but I guess I should maybe go with the Stack. Because now I want to add a text field box in the middle of the app bar that overflows in the down ...
I would like to do a refactoring of web API implemented in .NET Core. The Goal is to simplify Get method and to implement this to be more according to REST philosophy. I would appreciate any advice. As you can see the logic has many invalid combinations and too much code in one method. namespace Api.Treatments.V2 ...
I want to check that a some type has some methods: using Arg_t2 = int; using Arg_t3 = int; template<class T> struct ValidType{ using Ret_t1 = T; using Arg_t1 = int; // ... Ret_t1 method1(Arg_t1,Arg_t2,Arg_t3); //... }; Therefor I wrote a type-trait: #include <type_traits> template<class T,class _ = vo...
I'm not sure if Code Review is the proper SE site. If not, please point me in the right direction. Let's assume we have a simple function, where you can pass an array and it will do some work on it. For simplicity sake, let's just assume you pass an array of integers to the function and it doubles them I was wondering ...
I've just started the cryptopals-challenge, and now wanted to show my solution to the first challenge here: public class Challenge1_1 { public static void main(String[] args) { String hex = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; String ba...
I am writing a domino draw game in C# and would like to know if there is a simpler/better way to know the player that has been dealt the highest double bone (where x equals y) and what bone it is: public class Player { public string Name { get; set; } public List<Bone> Bones; public Player(string name) ...
I would like to record client information when they go into a location on the web site so I created this ProcessRequest class that will collect data and insert it into the database. This will collect HttpContext and send that data to a Store Procedure that will then insert into a database table. namespace DataCollectio...
In my project I used this code to create a GUI using JavaFX. The aim was to have a screen with 7 buttons on it. Next, depending on which button is pressed another set of buttons will appear on the screen. The user then chooses one of these which then sets an integer variable subchapter to a value and calls the next met...
I've now used the tips, you can find here and there, to improve my code: import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.Dimension; public class CaesarCipher { enum WhatToDo {ENCRYPT, DECRYPT}; public static void main(String[] args) { Str...
I'm required to calculate the average value of all nodes in a BST using a Visitor, I'm not sure if I did this correctly or if i could just calculate the average with inOrder() and therefore I'm not really utilizing the visitor. import java.util.*; public class Node{ int val; Node left; Node right; pri...
Supports backspacing, but not wrapped backspacing. %macro newline 0.nolist mov ax, 0E0Dh int 10h mov al, 0Ah int 10h %endmacro %macro getc 0.nolist %%get: mov ah, 11h int 16h ; get keystroke status jnz %%pressed hlt jmp %%get %%pressed: mo...
My best languages are Python and Rust, but I want to improve my C++ skills, so I decided to try my hand at Advent of Code 2019 in C++. So far I have not encountered any major issues, but I want to know what I am doing that is subtly (or not so subtly) wrong. The following program is my solution to the Day 9 problem. It...
I have been trying to come up a generic C linked list to store data as it comes and later sort them to use it for various purpose. Please have a look at the code below an provide me your review comments. This code compiles and runs in Windows and Linux. Naming Design Quality Usability you may run the main.c for exa...
I'm trying to implement some logic functions essential to control a small power system consisting of 2 Transformers labeled T1 and T2, 2 Generators (G1 and G2) and a bus tie (BT). I'm not going to overwhelm you with the unnecessary details. I need help figure out why my Arduino circuit doesn't work as expected even th...
I made this program to understand inheritance better. Now that I'm at this basic level it's not really a problem but I can see this coming in the future and so I'm asking what's the best method to ask the user to insert the width and height of a rectangle (in this case). The code I'm providing includes the simple way, ...
I've become a bit rusty in Java. This is an attempt at brushing up my skills. Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until t...
A collegue and me implemented a simulator the iterated prisoner dilemma from game theory in haskell. We would appreciate any feedback on the quality of the code, how things could be worked out more efficiantly or elegantly. The code file together with a tex file (along with the compiled PDF) in literate haskell style t...
I'm trying to realize simple testing application. And I ran into a problem. I have two arrays. The first is an array with the initial questions, the second array is the answers of users. And now I need to count the number of correct answers. I wrote the following code. I wonder: how optimal is it and, if it's bad, how ...
I have 3 radio buttons all grouped inside a group box in a WinForms project. Currently, I am checking which button is checked and assigning values using the following if/else statement, similar to the below example if (rb1.Checked) { selectedButton = 1; selectedButtonText = rb1.T...
Below is my code for the “Minimum Window Substring” LeetCode problem in Swift: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC My solution fails on a very long string, but passes ...
This little program was written for an assignment in a data structures and algorithms class. I'll just note the basic requirements: Given an inputted string along with mode (0=spell check, 1=AddToDictionary). If the mode is 0 the program should check to see if it exists in a dictionary of correctly spelled words. If no...
I would like to know if there are any things I could improve with the following code regarding writing it in a FP style: server.js: const express = require('express'); const app = express(); const person = require('./person'); app.get('/create-person/:name', (req, res) => { person.addPerson(req.params.name); r...
I am a beginner in Java. I have created this small project in Java with the inheritance concept. Here the Human will fill, pour and drink water. There are three classes: Glass, Jug and Human. Let me know how you think it is! Glass class: public class Glass { private float capacity = (float)0.5; private float q...
I have the following files: STUDENT_D19001.T103412_HU.txt STUDENT_D19001.T103412_KU.txt STUDENT_D19002.T113030_HU.txt STUDENT_D19002.T115055_KU.txt STUDENT_D19003.T115055_KU.txt STUDENT_D19004.T135040_HU.txt I want to process the common/pair files separately in this order (HU1 and then KU1; HU2 and then KU2) and the ...
I had another question for my Perl class assignment. Related question: Frequency analysis for simultaneous dice rolls use warnings; use diagnostics; use GD::Graph::hbars; use List::Util qw(max); my $number_of_dice=0; my $number_of_rolls=0; my @total_sum_of_eyes; my %count; my $counter=0; print "\n Plea...
I'm new to F# and functional programming in general (coming from an object oriented background). I just wanted to get some criticism on an algorithm for assigning jobs to crew members. I want to be as functional as possible and avoid loops and mutable state. Here is what I've come up with. let rec AssignJobs crewMember...
I created my first commit for ASF Maven today. In the PR I was asked two things. By the way: "understand" doesn't mean I speak another language. It is more about his and my opinions and arguments. Else-If instead of guard statements / early return So, there is no documentation and no check style rule that says this, bu...
I have a pandas data frame and I want to calculate some features based on some short_window, long_window and bins values. More specifically, for each different row, I want to calculate some features. In order to do so, I move one row forward the df_long = df.loc[row:long_window+row] such as in the first iteration the p...
I've created a simple JS 'To Do List' application. I'm very new to JS and this is the first JS project I have done. I would greatly appreciate any feedback on how to make the code more efficient, neater and better adhere to best practices. The 'To Do List' uses local storage to persist data, and does simple checks such...
I'm writing a helper script that I wish to be able to share with my co-workers. We all work using macOS Mojave, but all have their own shell configurations. For example, I actually use ZSH and bash 5.0. There are often times where I am working with data that is output from our nightly testing that runs on a remote clu...
Usually it is a good style in Java to create a named constant for a string (and other) hardcoded values. Using the example below I want to know how pedantic I should be in it. I use a Java class as a wrapper of XML settings. Each function is suppose to return a value from a related XML file. I defined a lot of constant...
My Objective is to create a fixed column array object of size 4 columns so that I can form a 2d array in the following format which I can use to print to a pdf later. The solution is working fine. But need help in figuring out if there is a better way to implement this. let input = [{ id:123, quantity: 4, value: ...
Is there a simpler way to write this ugly if/else statement? It's simply appending a query string to a url depending on whether the variables exist. if (start) { url += `?start=${start}`; if (end) { url += `&end=${end}`; } } else if (end) { url += `?end=${end}`; }
The desired behavior would be: [TestMethod] public void Compare_Value_Identity() { var source = new[] { 1, 2 }; var modified = new[] { 2, 3 }; var (inserted, deleted) = source.Compare(modified); CollectionAssert.AreEqual(new[] { 3 }, inserted.ToArray()); CollectionA...
I'm playing with ktor right now. If I understand this correctly, code in ktor's handlers need to be as asynchronous as possible. So I was trying to figure out how do you write synchronous (potentially expensive) code in a Kotlin coroutine. Here's what I've written: install(DefaultHeaders) install(CallLogging) {...
After a few trials I've written this code where the border of a link expands: a { position: relative; text-decoration: none; margin:0; } a::after{ content: ""; position: absolute; //relative to a bottom:0; left:0; width:0%; transition: 0.3s width ease-out; } a:hover::after { width:100%; border:...
The idea is to have a data structure that holds any number of objects of any type. Objects can be retrieved, or removed permanently, at random. Also, it can be cleared (or emptied). This class just provides the ability to select a random object from a collection, with the option of removing it. public class Sack { ...
I want to allow the user to enter a number of race results (A minimum of 2 participants and a maximum of 7) I feel that I could use a much shorter code, (I am a beginner of Java only 2 months so any recommendation would be highly useful! thank you Code below: int entrants = 0; String[][] runners = new String[2][2]; boo...
I want to create thumbnails from PDF files – specifically, a thumbnail of the first page. Currently I use pdftocairo on the command line: $ pdftocairo myfile.pdf -png -singlefile -scale-to-x 400 -scale-to-y -1 but I wanted to see if I could implement this without shelling out to an external tool. I've written a functi...
I am trying to solve this question. The essence of the problem is this: Given a list of school classes with start and end times, find the total number of non-overlapping subsets. I've written up a DP solution that I think is optimal in terms of time complexity - \$n * \log(n)\$. ''' https://www.spoj.com/problems/ACTI...
I wrote a class that extends the dict class to provide indexing like functionality, so I can find which key(s) map to a given value in the dict. It's pretty bare bones and there are a lot of things I haven't fleshed out like docstrings (will add these later when I have a final version), how to handle unhashable element...
I'm fairly new to HTML and CSS and I've put together a navigation bar. The purpose of the navigation bar is to be clean and mobile-friendly. I would appreciate some feedback on what I could do better within the code as I don't know what's best just yet. const navSlide = () => { const burger = document.querySelector...
I recently needed to run some command line applications from Python. Whilst this is fairly simple with subprocess.Popen. I wanted to be able to properly pipe the output. When running the programs from Python I want three things: The option to have a low memory footprint. This is possible with Popen by passing some, n...
Recently I was studying bitwise operators and bit-manipulation algorithms and I found out an algorithm to add two binary numbers. Pseudocode is as follows: function add(A, B): while B is greater than 0: U = A XOR B, where XOR = Bitwise XOR of A and B. V = A AND B, where AND = Bitwise AND of A and ...
Problem Given a set of formulas (AKA "Rules"), get a list containing every possible answer that does not break any formula. Formula variables can have a maximum equal to the number of characters. For example "ABC" can have a maximum value of 3, while "E" a maximum of 1. Example, given this set of Rules: {ABC + E} = 3...
For some database requests, I like to use raw ADO.NET. In the context of a web request, I have created a class which provides an open IDbConnection object. I use a Dependency Injection library ("DI") to do this, scoping the object instantiated from this class to a web request. So, disposal of the object is handled by ...
I am experimenting with cryptography and I was wondering if somebody has some suggestion how I could improve my code and methodology. I want my process to generate more securely the cryptography process if that is possible import java.security.GeneralSecurityException; import java.security.Key; import java.util.Base64;...
I am learning Python and I know that a lot of my future projects will be based on files and managing them. How does this look? Is anything in here redundant or overcomplicated? import os import zipfile import shutil from datetime import datetime as dt class File: def __init__(self, path, datetime=True): s...
Optimizing/parsing files into semi-complex data-structures more efficiently To preface, I'd like to say that this code is part of the Advent of Code 2019 solutions I have been working on. Particularly #14. --- Day 14: Space Stoichiometry --- As you approach the rings of Saturn, your ship's low fuel indicator turns ...
I have REST API written on laravel and front end on vue.js. It is a dashboard for an ecommerce store where you can connect to post shipment service API to upload order shipment data and get tracking number (with .png label). So after I receive tracking number label from post service API I need possibility to show it in...
Usually I have really noisy datasets, so peak detection is quite hard to do just with coding. However the human brain immediately sees what is just random noise. I decided to make a basic peak editing functionality with matplotlib. I added a toggle button to the navigation toolbar to switch on and off the recording. Th...
I have two methods I'd like to improve using optional and any other tool, @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if (user == null) { throw new UsernameNotFoundException(Stri...
I am creating a package to be used in our company that adds the root of the project to the system path. I will add a source_root.config file in our root directory. add_root_path.py import sys import inspect from pathlib import Path from inspect import getsourcefile CUR_FILE = Path(getsourcefile(lambda:0)).name SOURCE...
For me, learning the basics of a new programming language is best done through some easy to intermediate challenges. Here's one that's rather well known and relatively simple - determine if a triangle is equilateral, isosceles, or scalene. Here's my try in Golang. Since I'm totally new to Go, I'm pretty sure this can b...
Is the single method printMaxDistance_a or the two methods printMaxDistance_b AND printMaxDistance_c better or respectively "more readable"? Thanks. public static void printMaxDistance_a(String s) { int first = 0; int second = 0; int max = 0; for (int i = 0; i < s.length(); i++) { for (int j = i...
I'm working on a project in which I have a backend in nodejs and from there I need to call external APIs, those APIs require authentication token which is valid for 15 minutes. So if response status from external APIs is 401 then I need to generate a new token then call the request. In my backend, I'm using request-pro...
I have an Oracle GIS database that has spatial tables. The records in the spatial tables have a geometry column that contains polylines. I've written a Python 2.7.16 script that calculates the midpoint of the polylines and inserts the midpoint information into parallel tables. The script will be run as part of a nightl...
AFAIK Octave still does not support enumerations, so I've done my best to write a workaround. The question is if there is something missing in code below, or maybe something can be improved? The reason for the enumConstructor method is that with Octave 4.2.0 I had errors when overloading the constructor. classdef Enum ...
This is an update to my earlier question From Q to compiler in less than 30 seconds. As with that version, this Python script automatically downloads the markdown from any question on Code Review and saves it to a local file using Unix-style line endings. For instance, to fetch the markdown for that older question, one...
I have a sorted list of materialized hierarchy paths: paths = ['10001', '1000100001', '100010000100001', '100010000100002', '1000100002', '100010000200001', '100010000200002'] I am getting the immediate children paths (nodes) for each non leaf node. steplen = 5 # size of each hierarchy step max_depth = len(max(paths, ...
I have tried to implement the Selection Sort Algorithm in two different ways, and I was just wondering if that is considered to be a valid implementation of that algorithm. Would that be also considered an efficient implementation of the algorithm, or are there different and more efficient ways? Here are my implementat...
This is a basic game asking for the common port number for a protocol used. I designed it with the intent on helping myself and others who are going after their Sec+ exam to memorize the ports needed. Any in cleaning up the code or better ways to process the lists would be most appreciated. import random import sys f...
I have the following code import time from flask import Flask, request from flask_restful import Resource, Api import threading app = Flask(__name__) api = Api(app) class A: def __init__(self): self.x = 5 def increment_x(self): self.x += 1 def get_x(self): return self.x def a_...