Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Add this tag to your question to indicate that you are new to the language of your code. This will often be taken into consideration by reviewers when assessing your code.

1
vote
1answer
18 views

k-armed bandit problem in Python

I implemented k-armed bandit problem in C#, MATLAB and Python. C# and Matlab code run fairly fast (With same settings of T = 2000 and nRun = 1000 the elapsed time is about 6sec). However, the Python ...
3
votes
2answers
31 views

Python 2.7 Powerball Game

This game allows one to either pick their own lottery numbers or have them generated and checks them with the most recent numbers, jackpot, and multiplier. I use concepts such as ...
1
vote
0answers
10 views

Clojure macro to gather functions in a namespace into a map

I'm learning Clojure via a pet project. The project would consist of several workers that would be called from other functions. Each worker is defined in their own namespace as a set of functions (...
2
votes
1answer
26 views

TypeWriter Javascript effect

I have implemented a Javascript TypeWriter effect for my website. It types out code using the TypeWriter variable by adding each character on and setting a timeout. It then 'deletes' code using text ...
6
votes
2answers
146 views

Random quote rotator

On my website, I created like this banner that rotates quotes from an array I made. ...
1
vote
2answers
43 views

Subset Sums in Java

Given an array of integers, print sums of all subsets in it. Output should be printed in increasing order of sums. Input : arr[] = {2, 3} Output: 0 2 3 5 Input : ...
6
votes
2answers
203 views

Find files by pattern and copy to target location

This is my solution to the Chapter 9 exercise in Automate the Boring Stuff: Selective Copy Write a program that walks through a folder tree and searches for files with a certain file extension ...
1
vote
2answers
46 views

Sort all even numbers in ascending order and then sort all odd numbers in Descending order Java

Given an array of integers (both odd and even), the task is to sort them in such a way that the first part of the array contains odd numbers sorted in descending order, rest portion contains even ...
5
votes
2answers
261 views

Vowel Counter 2000

Today I present to you a program that: Identifies vowels and their total number Prints each vowel's numeric value Adds the numeric value of each vowel found Prints which letters are NOT vowels If ...
0
votes
0answers
17 views

Basic dictionary script [on hold]

Well i have this code i wrote that prints the inventory ...
1
vote
0answers
28 views

Displaying topics in a PHP forum

I am very new to PHP. I've only been using it for a few months. I'm currently attempting to build a forum and wanted feedback on some of the code I have so far. These are two files I feel like could ...
5
votes
0answers
83 views

A simple brainf*** interpreter in Haskell

I am very new to Haskell and come from languages like C++, although I do have some experience with Scheme. Here, I wrote a simple brainf*** interpreter, which so far is my largest project. I followed ...
12
votes
5answers
1k views

Processing XYZ data from a large file

I'm new to programming (1.5 years experience at university), and I'm working on my first computer vision related project! My goal is to take a file which might have CSV (comma separated) or txt format ...
3
votes
3answers
82 views

Find the year when the user will turn 100

I moved to Python today after doing a little of c++. The following code works as intended, but I want to know if I should add the if __name__ == "__main__" ...
1
vote
0answers
14 views

Simple ruby program for AWS ruby SDK

I wrote a simple ruby program for interacting with one of my temporary AWS S3 using Ruby SDK. Below is the program I've written. Since I learned ruby by myself I need help/suggestions in following ...
-2
votes
1answer
84 views

Project Euler Problem 1 with Python 3 ideal solution

I have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required. If we list all the natural ...
-2
votes
0answers
25 views

Python ABS Chapter 8 - Allow users to change words in a text via Input [on hold]

So the assignment is: Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file. For ...
3
votes
1answer
63 views

FizzBuzz in Common Lisp

Where I stand on Lisp So, Lisp. It's been on my radar for years and I'm finally getting around to learning it. The syntax is foreign but I find I'm having the most difficulty in the areas of ...
3
votes
2answers
48 views

Using Python to create a JSON file of recipes from MySQL

I needed to create a JSON file from a couple of MySQL tables to migrate some recipes from wordpress. This was my first time writing a script in python and would like to get some feedback on what I ...
1
vote
0answers
17 views

Dim Hero & Add Background to Nav on scroll

I have followed a tutorial that initially was for adding a 'sticky' nav. I adapted this slightly so it adds a background to the Nav when the page scroll reaches the top-third point of the hero area. ...
0
votes
0answers
36 views

Greatest prime factor [closed]

Code: (edits are appreciated) ...
4
votes
2answers
42 views

Vanilla JS calculator for learning coding fundamentals

Since I am self taught, I would greatly appreciate some input on my code for this JS calculator: What redundancies i'm failing to see and remove? How is my naming for var's and functions? Is it clear ...
5
votes
2answers
56 views

National Insurance Number Validation

I'm a beginner to PHP and I've written a function that validates a U.K National Insurance Number. The function works by checking whether the given number against the format below; The National ...
7
votes
7answers
158 views

Calculating frequency of a note from a string

I've been working on a solution to Pset3 of CS50 Harvard course for last couple of hours and managed to finish it. Although it works as intended I'm unhappy with how clean this code is, mostly because ...
0
votes
1answer
57 views

Pythagorean Theorem in Java

I'm new to Java and am following a series of lectures on Stanford's YouTube. I know that the code works, but I'd like to know if it can be improved upon. ...
4
votes
1answer
101 views

Sieve of Eratosthenes in Python

This is yet another take in Python for the infamous Sieve of Eratosthenes. I am a beginner in Python so any criticism is highly appreciated. ...
4
votes
2answers
84 views

Minimum difference between numbers in a file

I'm learning Java and I created a simple solution for the following problem: Given a file [filename].txt such that each line has the format ...
3
votes
1answer
31 views

Searching Online English Dictionaries - follow-up

This is a follow-up to Searching online English dictionaries: ...
2
votes
1answer
63 views

Breakout-style game

I'm trying to learn how to program with Java which is more or less my first programming language (had some basic Pascal and C,C++ in school and college) but still a Beginner, with a capital 'B'. ...
0
votes
1answer
61 views

Batch processing large text files for sentiment analysis

I have written this script in Python 2.7 and I was wondering where I could improve it or efficient. This is my first script so I don't now much. The script takes a text file from a folder removes ...
4
votes
3answers
104 views

Java RPG battle simulator

I'm coding a turn-based RPG battle simulator (text based) in Java. I'm doing this as an exercise/project to learn OOP design. I've coded something similar in C, but just porting that code over to ...
6
votes
2answers
272 views

UDP Reverse Shell

I'm currently learning python / network programming altogether and I coded this simple python reverse shell; I would like to hear any remarks from you regarding code structure, any common beginner ...
3
votes
1answer
52 views

Conditionally displaying a notice about free shipping in Woocommerce

I wrote PHP code to display a Woocommerce notice - "free shipping for $40 & under" only once on shop page and once on cart page, but also in cart should not be more than 40$. The code works, but ...
10
votes
4answers
693 views

Calculating primes until a user-given value

I am new to C# programming. I wrote a little program in C# to calculate all primes until a user-given value. Ignoring the lack of computing power I wrote this program to handle theoretically very huge ...
0
votes
3answers
67 views

“Human” interfaces with two implementation classes

The Helloworld class executes all of the methods. Human is the interface, and Nate & <...
2
votes
4answers
122 views

Generic Single Linked List Using Smart Pointers Follow up

I am extending this post following from here. I made some of the changes that I could make in the previous post. Although, I have not been successful in creating iterators for my class. The reason ...
6
votes
2answers
89 views

Command line tool, listing video files on a local drive

Explanation I started learning Haskell about a month ago. As an exercise, I recreated a little command line tool, which I had previously written in PowerShell. In the current state, it displays a ...
7
votes
2answers
628 views

Determining whether a provided credit card number is valid according to Luhn’s algorithm

I have been working on credit problem for edx CS50 and got it working as intended. an issue I find with it is the way I have to reinitialise the cardNumber variable ...
4
votes
4answers
361 views

Initialized Array Template Class (C++)

The problem We want to use a very large array for some computations. When created, all the elements of this array have to be initialized to some value. We'll only use a few values from the array1,...
6
votes
2answers
97 views

Phone book program using hash table in C++

I am a student and I am implementing data structures concept by myself using C and C++. I have implemented the concept of hash table here by making a "Phone book" program that takes input which ...
5
votes
5answers
188 views

Sort an array of 0s, 1s and 2s in Java

Write a program to sort an array of 0's,1's and 2's in ascending order. Input: The first line contains an integer 'T' denoting the total number of test cases. In each test cases, First ...
4
votes
1answer
55 views

A simple implementation of the Unix find command written in Rust

I'm a C++ developer trying to learn Rust for fun and XP. I decided to implement some of the Unix tools for practice. Below is a simplified implementation of the ...
6
votes
2answers
522 views

Simple Censor Program

I made a function to censor a certain word from a piece of text. Is there anything I should fix or do more efficiently? What are some other approaches I could have taken to detecting words and ...
5
votes
2answers
75 views

Pig Latin Anslatortray

I've created a program that translates any word into the form of igpay atinlay or pig Latin! I got the project idea from here and you can read the rules here. My program outputs the same translation ...
4
votes
2answers
71 views

Python Turtle based Pong game

I'm new to Python but I've coded in other languages mainly for hardware. I made Pong in Python using turtle but it's a little glitchy. I was wondering if any of you guys could check it out and give ...
8
votes
3answers
406 views

Simple Shop Program

I'm new to programming and this is one of my first programs. I had no idea what I was doing so most of this program was made from bad bug-fixing that barely managed to fix the bugs. I'm sure that ...
2
votes
6answers
416 views

Alone in a Couple implementation in Java

In a party everyone is in couple except one. People who are in couple have same numbers. Find out the person who is not in couple. Input: The first line contains an integer \$T\$ denoting ...
16
votes
7answers
2k views

Program to check if a date is valid or not

I am a novice programmer and am currently learning Python programming by myself through a book. I stumbled upon a question in a chapter and it took me 2 days to figure out a solution for it. Although, ...
3
votes
2answers
118 views

Attempt at checking whether two words are permutations

This is my first algorithm in C++ ever to check if two strings are permutations of each other. Please provide guidance on correctness of algorithm + ways to improve + thoughts on my use of the ...
3
votes
3answers
137 views

Simple C++ calculator

I'm a programming newbie. In fact, this is my second code ever (after Hello World). I did a lot of reading actually, here on Stack Overflow, and other websites. I would like to know if there's a way ...