Questions tagged [beginner]

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.

Filter by
Sorted by
Tagged with
2
votes
1answer
65 views

Toggling a class in JS

I'm toggling the class of an element with this code but I'm pretty sure it can be written more efficiently. ...
1
vote
2answers
101 views

Object-oriented implementation on Expense Tracking App [closed]

I am creating a Expense Tracking Application in C# and right now I am trying to build its building blocks in a console app. I Would like to know your feedback if it is in a Object Oriented Design/...
6
votes
3answers
108 views

Class for managing a list of scores (game development)

For my game that I'm writing, I need, among other things, a data structure for storing best values. For this purpose, I tried to write a class that meets the most general needs, and yet does not seem ...
5
votes
1answer
102 views

Find the longest word in a string

I have written code in the language Go. I wonder if anyone can do it in a very simple and effective way, because every language has its own way to solve this problem. My experience is in JavaScript. ...
11
votes
1answer
198 views

Simple log rotation script

I created a simple script that implements log rotation. It checks the log file size (say, out.log) if it exceeds 5MB limit. If it does then the script copies it to <...
3
votes
0answers
33 views

Rust Iterator that correlates a slice with itself

In my effort to learn Rust I've tried implementing an Iterator that splits up a buffer in two halves, and correlates both halves by sliding them over each other with different positions (lags). You ...
4
votes
3answers
78 views

Toggling only a single class as active in a list with vanilla JS or CSS

Every time I toggle active class in a list (to dynamically change DOM content) I find that I always go to this approach to check and clear which class is active. I'...
7
votes
1answer
70 views

Parse a WAV file and export PCM data

I'm a newbie and I wrote code that gets a WAV file and exports a RAW (only PCM data) to *.raw file. But I am confused about the structure. The code is written as one procedure (LISP style) and there ...
2
votes
0answers
27 views

The modularization of the Express entry point

I've been working on a project to make myself more comfortable with NodeJS, especially Express and TypeScript. Searching and reviewing a lot of approaches of the people, providing bootstraps for it, I ...
-1
votes
1answer
42 views

Perform KS-test on Random Number Generator [closed]

I've just started practicing Functional Programming in Scala in some days. This is the code I used to perform KS-test on a random number generator. ...
1
vote
0answers
16 views

Cycle through filenames in vim

So I have a list of files which names are something like this ...
4
votes
2answers
58 views

Python logging-module that writes to both the console and a file

I've created a small module with a function plog() that allows to easily print to both a log file and the console. It also creates a directory "log" at the location ...
3
votes
0answers
87 views

Simple C++ Console Snake Game

I'm a beginner programmer and i'm looking for interesting projects to improve my low skills. I decided to spend one evening on simple snake game in console. I made it with the help of YouTube tutorial....
5
votes
1answer
90 views

TicTacToe classic in C

I'm learning myself C and to make sure that I learn to code C in a proper way I created tic tac toe and want to hear your opinion on what I should do and what I shouldn't do. One thing is sure is to ...
3
votes
1answer
33 views

Syncing GitHub repositories local, remote and forks

It's a simple bash script but I'm hoping for feedback, advice and examples on how to improve the script and code. Can you guide me how to put more checks in the code and more if possible? This code: ...
0
votes
0answers
47 views

My first c# program: Get Data from Sql Server and show it in Textboxes

So I have been programming in VB.net and want to learn C#. I "successfully" created a simple program that retrieves data from Sql Server during Form1_Load. The ...
4
votes
3answers
269 views

Swimming Pool Staff/Patron Structure

To work on my Java skills, I decided to create a structure for a pool that I work at. Lifeguards get shifted when their time at their position is up, and managers periodically check the pH level of ...
7
votes
1answer
39 views

Bash script to encode images in base64 and generate a CSS file from them

These are the first lines of code I've ever written. I've been interested in the idea of learning to program for quite a while, but never really pulled the trigger, and now I've been playing around ...
-2
votes
1answer
40 views

3D vectors in Objective C

I am trying to learn Objective C and want to make sure I am following the proper practices/convention. I would very much appreciate advice on what to change/improve I also have some questions: when ...
5
votes
1answer
97 views

C++ practice project: Blackjack

For the longest time I always felt lost designing a robust OOP program, especially in C++. I felt like I didn't know enough theory or algorithms so I would study and never write code, not to mention I ...
2
votes
0answers
97 views

Javascript contact picker

I'm developing a web app that will be used privately by a company (no need for SEO and old browsers support). I made some interactive components (calendar, file manager, etc) that I am not sure if I ...
2
votes
0answers
38 views

Code to backup the history file in Linux

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file; I just wrote it and I've tested it and it almost works. This was the ...
6
votes
1answer
98 views

Minimax implementation of tic tac toe

I have the following working tic tac toe program. Someone said it's a convoluted mess and I'm looking for pointers on how to clean it up. ...
0
votes
1answer
111 views

Automate the Boring Stuff - Collatz Exercise

I wrote the following code for the Collatz exercise: The Collatz Sequence Any feedback is appreciated. Write a function named collatz() that has one parameter ...
1
vote
1answer
67 views

Bash Code to backup the history file in Linux [closed]

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file, I just wrote it. The code is supposed to do this: Backup my ...
9
votes
5answers
2k views

Java guess the number

I have just returned to college to finish my associate's in programming. The language my school uses for all of the programming classes is java, so I've been trying to get used to the language. The ...
6
votes
2answers
63 views

Simple prime factorization program in Haskell

I'm finally learning Haskell this summer and I have a few questions about conventions. I made a simple prime factorization program which is surprisingly fast, much faster than the ones I made in C++ (...
9
votes
3answers
93 views

Console Blackjack game, without split or betting system for now

I never programmed in my life, and I am currently self teaching myself some C++ by reading books, online free classes and googling. After beginning to read about OOP and classes, and after seeing that ...
2
votes
1answer
98 views

Hangman game with Python 3

I tried to create a "guess the word" game. I would appreciate to get some suggestion to improve myself, because I'm new at Python. ...
6
votes
1answer
81 views

Python script to clean out old files from a repository

I wrote the script below as my first python program that will be running in a production environment. Essentially this program looks at a source location and moves all the files to a destination ...
0
votes
0answers
13 views

CLI to make HTTP Head requests and check for response code

I needed to create a simple CLI utility to check if a specific endpoint is available and (optionally) responds with some expected HTTP code to help troubleshoot users environments (proxy, network ...
1
vote
0answers
68 views

Python 3 Tkinter Calculator - follow-up

I'm a beginner developer, and it's my very first project: a simple math operations calculator in Python 3 using Tkinter for GUI. Obs: This code is an evolution of my previous code of the same project:...
18
votes
6answers
3k views

Comma Code - Ch. 4 Automate the Boring Stuff

I am new to programming and currently learning Python using "Automate the Boring" by Al Sweigart. I've just completed the "Comma Code" task in Chapter 4 and would like some feedback on my solution. ...
3
votes
1answer
53 views

JS Simple game in canvas

I'm trying to learn javascript (especially the OOP part) and made this simple game. I'm looking for advice and ways to improve my code. Did I handle OOP well enough? What's the best way to create a ...
4
votes
0answers
83 views

Rabin-Karp algorithm implementation

This code uses the Rabin-Karp algorithm to compare two text files. It takes a few minutes when both files contain around 1000 words. How can I improve? ...
6
votes
2answers
104 views

Guttag's Finger Exercises: Enter 10 integers, find largest odd integer and print result

I'm making my way through the Intro to Computation and Programming test by John Guttag and he gives these small exercises to practice gearing up into computational thinking. As of Ch.2, we've covered ...
7
votes
1answer
630 views

Python program to convert a 24 hour format to 12 hour format

Given a string in a 24 hour format the program outputs a 12 hour format. The rules are: The output format must be 'hh:mm a.m.' if it represents before midday and 'hh:mm p.m.' after midday When the ...
17
votes
7answers
5k views

Tic-Tac-Toe for the terminal

I recently started learning C, and this is my first fairly large (to me) program. It's a basic Tic Tac Toe game for the console. There's no AI, it's just a 2-player game. Is there anything I can ...
7
votes
2answers
270 views

Credit card validator using Luhn Algorithm

I'm looking for feedback or tips to maybe make my code more readable or faster or just general tips to help get myself started with app making with Python. ...
3
votes
1answer
25 views

Babel code in React component to display tasks

I'm trying to think of ways to clean up this component in my app so it looks more readable to other devs. This is the best I came up with so far. It's not that bad, but I think it could be a lot ...
5
votes
1answer
99 views

Beginner's Snake Game using SFML and C++

Never really got past the beginner stage of programming so I'm trying to get better this Summer. I think games are a fun way to learn how to program so I decided to start with snake. I'd appreciate ...
5
votes
1answer
52 views

Add-in for input() with validation

What do you think about this code? Do you have some advices and remarks for me about them? I have started learning python recently. ...
2
votes
2answers
125 views

Python program to get the first word

Given a string the task it to find its first word with some rules: The string can have points and commas A word can start with a letter, a point or space One word can contain one apostrophe and it ...
3
votes
1answer
96 views

Python program to calculate the sun angle

Given a string representing the hour and minute, where: 00:00 <= time <= 23:59, the program should output the number of angles the sun is above the horizon. When time is "06:00" the sun angles ...
1
vote
2answers
316 views

Python program to get the longest substring of the same character

Given a word the program outputs the length of the longest substring with the same letters. For example: long_repeat('sdsffffse') == 4 long_repeat('ddvvrwwwrggg') == 3 long_repeat('abababaab') == 2 ...
8
votes
3answers
450 views

Python program to calculate what pawns are safe

In chess there are eight rows numbered from 1 to 8 and 8 columns a-h. Pawns which are on the lowest row are always in danger to be captured. The objective of the program is to calculate which pawns ...
3
votes
2answers
52 views

Python program to translate sentences from “bird language”

Given a sentence in 'bird language', where there are two rules: After each consonant there is a random vowel added. For example if the consonant is "l" it will end as "la" or "le"... After each vowel ...
2
votes
1answer
70 views

Stacker game with three blocks

I am pretty new to C# and so i would like to ask you, how i could improve my code. I am currently coding a Visual Studio C# Console Game where you have to stack blocks. Currently you can only Stack 3 ...
1
vote
2answers
49 views

Function to count words in Python

I am new to developing in Python and would like to see comments about my word count solution. Please indicate my mistakes or best solutions. ...
2
votes
2answers
53 views

Python program to get all non unique elements in an array

Given an array of ints as input: non_unique([1, 2, 3, 1, 3]) returns [1, 3, 1, 3] non_unique([1, 2, 3, 4, 5]) returns [] non_unique([5, 5, 5, 5, 5]) returns [5,5,5,5,5] non_unique([10, 9, 10, 10, 9, ...