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
0 votes
0 answers
41 views

Script to fix linkage done with #pragma comment(lib, "a.lib) for Visual Studio project

I have a legacy project that has a lot of linkage done using #pragma comment(lib, "libname.lib"). Moreover, some projects define linker directives in ...
user avatar
3 votes
1 answer
86 views

Variable Grid Size Tic Tac Toe

Tic-Tac-Toe from scratch. Code Ugliness check before I implement the win-condition and maybe get set in to bad habits. Questions: As implemented: Better to pass board between functions or set as a ...
user avatar
1 vote
3 answers
134 views

Export DGV data as a table to a word file using Xceed's DocX library

my winform app contains a combo box, a button and two datagridview among other controls. Both DGV's have 3 columns. When I select an item/items from one or both of the DGV's and hit the button the app ...
user avatar
2 votes
1 answer
79 views

AdventofCode 2021: Day 3 Solution

I am beginner to Haskell. Here is my solution to Advent of Code 2021 Day 3. Let me know what you think. I was looking at the transpose function and decided not to use head & tail function. Given ...
user avatar
  • 237
0 votes
1 answer
80 views

Go logging wrapper that adds log levels

The package is essentially a small wrapper around the stdlib logger that provides a very simple, easy to use logger that can toggle between different log levels (DEBUG, INFO, WARNING, ERROR). Log ...
user avatar
15 votes
4 answers
4k views

Split a restaurant bill, including tip

Just looking for a little feedback on the below tip calculator I've coded rounding the output to nearest 2 decimal places. Just wondered if it was readable and code friendly? ...
user avatar
1 vote
1 answer
51 views

Conditionally drop rows in grouped data.frame using dplyr in R

I have a data frame with columns for three predictors that try to predict the target variable 'change' with values 'yes' and 'no'. The data frame is grouped by id, and for every id, I have 4 years. ...
user avatar
  • 113
6 votes
1 answer
145 views

Rust CLI for playing Wordle

I wrote the following CLI for playing the popular word game - Wordle. Wordle is a word game in which players are trying to guess a 5 letter word. Each turn they guess one 5 letter word, and for each ...
user avatar
  • 163
2 votes
0 answers
71 views

Parallelized Web Crawler

Exercise is here: https://go.dev/tour/concurrency/10 Prompt: In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel ...
user avatar
8 votes
3 answers
441 views

Implementing a efficient Infix to Postfix using Shunting-yard algorithm

I was trying to implement an efficient (in terms of size of code (such as using one liners) and time and memory-efficient) of Infix to Postfix in python without the use of any external modules i.e ...
user avatar
3 votes
3 answers
123 views

Bird watching database in Java

I'm learning Java in a MOOC right now and this is my solution for exercise Big year. This is the exercise: In this exercise you will design and implement a database for bird-watchers. The database ...
user avatar
  • 41
6 votes
4 answers
654 views

Simple Singly-Linked List class

Decided to write something simple and came up with idea to write simple single linked list in C++ to improve my knowledge about pointers and memory management in C++, and wrote this: ...
user avatar
  • 105
1 vote
2 answers
116 views

Function wrapper that prints the result

(English) I was recently challenged to make a simple program that does the following: Function f accepts as a parameter a function g, which returns a value. Function f must return a function h which ...
user avatar
  • 13
3 votes
4 answers
358 views

Find differences between two directories

Coming from another language than Python, I would like to see if my code is "pythonic" enough and follows good practices. It compares two directories, showing all files that are in one and ...
user avatar
  • 137
2 votes
1 answer
93 views

Can you criticise my Snake Game in C?

This is my first year at university, and I'm trying to learn everything about fundamentals. I've coded a snake game recently in C. This is a programming-challenge that I've given to myself to practice ...
user avatar
2 votes
2 answers
127 views

Remove else-if statement from multi-conditional logic

INTRODUCTION I am studying the book Five Lines of Code (2021) by Christian Clause. The book covers several techniques regarding refactoring legacy code. I am learning much and applying several of its ...
user avatar
11 votes
4 answers
3k views

Zipping two lists with an offset in Python

Walking my first steps in Python from C, I find myself missing pointers from time to time. In this case I want to go through a list processing two element at a time, where those elements are step ...
user avatar
  • 113
4 votes
2 answers
126 views

All In One Stock, Program for My business

I built my first program to solve an issue occurring at my self-owned business.. This program I made after learning a bit of C. It took about a month to make and what it performs is various functions ...
user avatar
2 votes
0 answers
118 views

OOP Blackjack in Python 3.9.9

I've noticed I'm not the first to post this topic. As a matter of fact, I have taken some inspiration from Victor Nguyen Bao's post to help structure my code. Here's the link to his code: Structured ...
user avatar
4 votes
2 answers
412 views

C++ simple 2D vector

I'm brand new to cpp and tried implementing a simple Vector class that supports abs(), equality and addition operators. I just wanted a quick set of eyes to tell me if I'm doing anything egregious in ...
user avatar
2 votes
2 answers
70 views

commandline Password-Generator in Kotlin

So I (a newbie to programming) wrote this password-generator as one of my very first programs in Kotlin. I started with Java a few weeks ago. I soon realized that Java was too hard for me, so I ...
user avatar
1 vote
1 answer
122 views

Conway's Game of Life in C++ with a Board Struct

I made the game of Life in C++ for a highschool class project. The website we're using doesn't have an autograder for C++, and my programming teacher doesn't really know how to program... so I'd love ...
user avatar
1 vote
0 answers
51 views

Lock-Free Single Reader/Single Writer Lamport Queue

I've created a lock-free lamport queue in rust. My code should be clear enough that you won't need to understand a lamport queue before reading it, but if you'd like a reference, this paper give a ...
user avatar
4 votes
2 answers
141 views

C++ calculator supporting five operators

Recently I started learning c++ and I had an idea to make a calculator, that can take any imaginable number and I wrote this code: ...
user avatar
  • 105
1 vote
1 answer
373 views

How do I get the unique list of values from a hashmap in rust?

I have the following code which finds all the unique values from a hashmap of String to Vec. I cobbled it together (eventually as I was getting various borrow errors along the way), but it looks a ...
user avatar
3 votes
2 answers
428 views

Print square numbers from 1 to 9999 (non-tradfn)

I'm making a simple program that outputs the squares. I have a question: Is there a way to improve the speed but make the Code readable? Code ...
user avatar
1 vote
0 answers
96 views

Java reimplementation of the Python difflib.SequenceMatcher class

I'm rewriting a Python script into an Android app. This script uses difflib.SequenceMatcher to compare sequence of strings. I haven't been able to find something ...
user avatar
  • 235
2 votes
3 answers
67 views

Javascript date / time display

I'm writing a simple start page and it's my first time with JavaScript, my previous background is Python/VBScript. Is it good enough? What best practices should I apply? Should I compress and nest the ...
user avatar
2 votes
0 answers
57 views

Flask API application to serve SPA webapp

I've recently started learning python to gain some fullstack skills and am working on a backend for a webapp as a learning project. Before I get too far down this path I was wondering if someone ...
user avatar
  • 121
4 votes
2 answers
77 views

Linked list implementation for a beginner in C

So I've decided to dabble a bit into C, and while it's trippy as heck I've finished an implementation of a linked list for practice. I've pretty sure there's some type of obscure bug or memory leak in ...
user avatar
  • 41
2 votes
1 answer
75 views

Finding cycles in graph

I found this code for Java to find if graph has cycles and I edited it to print out path of cycle. I use adjacency list. As it is directed weighted graph I will need to implement compensations of ...
user avatar
  • 123
0 votes
3 answers
83 views

Object-Oriented Hangman In Python [Follow-Up]

This is a follow up after revisions made from this question. I've separated the program into 2 classes. The HangManData class is used to store game data such as the ...
user avatar
4 votes
1 answer
78 views

Objected-Oriented Hangman game In Python

I'm still a beginner in python and made this simple program to practice OOP, I've ended up using the self keyword a lot and I'm not sure if this is normal or if I ...
user avatar
0 votes
0 answers
31 views

A bit of inventory management code I made using ScriptableObjects in Unity that lets you find items, check if you have items, and take items

It took me a while to figure this out, it's probably the most flexible code I've made. There might be some small mistake somewhere as I didn't get to fully test it, I'm just looking for glaring issues ...
user avatar
  • 43
4 votes
1 answer
45 views

Four HTML tabs elements, with fade animations, activated by buttons

I am pretty new to Javascript and trying to make a really simple tabs element which is just hiding and showing sections depending on which button is clicked. I know that this is a terrible way of ...
user avatar
4 votes
2 answers
1k views

Budget Analysis Program

I have written code for a budget calculate program. Here is the problem : Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompts ...
user avatar
  • 103
0 votes
0 answers
32 views

Shell script to invalidate AWS cache

I made this script to invalidate AWS cache. The purpose of this script is to retry the command multiple times because we make a lot of invalidations and we often reach the number of concurrent ...
user avatar
10 votes
6 answers
3k views

Console Library System in C++

I'm a beginner and came up with this simple project in C++. Any feedback would be very much appreciated. GitHub Repo Note: I'm using a file called "db.txt" as a database. main.cpp ...
user avatar
  • 119
5 votes
1 answer
71 views

Text adventure combat prototype

I am pretty new to Python and programming in general, since I go to a programming school I am learning a lot of things by the book, which personally it doesn't suit me and I am falling behind everyone....
user avatar
1 vote
0 answers
81 views

maximum total reward of a game

The code is an attempted divide and conquer method of finding the maximum total reward of a game where each turn two adjacent numbers in an arbitrary list are multiplied by each other to create a ...
user avatar
5 votes
7 answers
2k views

Determine if a word is a palindrome

I'm a newbie programmer and was given a task to find if the input word is a palindrome or not. Now, I've written the program to the best of my ability but would like to know how it could be improved. ...
user avatar
6 votes
1 answer
730 views

Hot Dog Cookout Calculator

Hiii... Can you please check the code and see whether I might have done a mistake ? Beginner's eyes can be misleading quite easily. I feel like there's something wrong in this solution. I can't ...
user avatar
  • 103
3 votes
1 answer
111 views

Idiomatic way to extract matches from rust Regex?

I'm learning rust and doing an exercise where to parse a particular SGML document. Each line in a document can be either an opening tag "" , a closing tag "" or a scalar: " ...
user avatar
3 votes
1 answer
214 views

Generate and display usernames

Everything currently works exactly as requested by the instructor, I've included as much possible commented documentation as I can think of to make it easier for people to see what the required ...
user avatar
0 votes
0 answers
67 views

Cookbook app in next.js

To start I'd like say that I'm a beginner writing my first Next.js app though I feel this question is more React related. I'm building an app where an user can add/edit stored food, recipes etc. which ...
user avatar
2 votes
1 answer
73 views

Simple Rock Paper Scissors game in Python

I am trying to write a simple rock paper scissors game in pycharm using classes and pygame. So far, I have not incorporated pygame yet. My idea is to import images that change in regards to the user's ...
user avatar
  • 21
1 vote
1 answer
45 views

Rust Pig Latin Translator - Idiomatic suggestions

This is the code I came up with for the Rust pig latin exercise. I am looking for suggestions on how to make it more idiomatic. I think working with iterators instead of chars and Strings would be a ...
user avatar
0 votes
1 answer
80 views

Simple sort function

I am learning Python and for practice I have written this function which sorts a list. Can you please provide feedback on how I have structured it and what better ways could be there to write it for ...
user avatar
4 votes
2 answers
258 views

Higher lower game

I'm currently learning python with an udemy course. I wrote this code, which is meant to be a higher lower game, where the second answer always stays. As far as i tested it my code is working fine, ...
user avatar
0 votes
1 answer
35 views

Quicksort Invariant and steps to determine correcteness

I am having trouble with applying to 3 steps needed to proof correctness, most likely because I did not formally study CS or Mathematics and am still learning about loop and class invariants. The ...
user avatar
  • 41