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
4
votes
3answers
158 views

Converting lengths and weights using functions in C++

Question is: Write a program that asks the user if he or she wants to convert lengths or weights. If the user chooses lengths, then the program asks the user if he or she wants to convert from feet ...
1
vote
2answers
14 views

Student Registry Program

Or in other words, a student database program. What does the code do? Checks if there is a text file - if not, creates one with table such as: student's name student's surname student's id and so on....
1
vote
1answer
31 views

CS50 mario printing pyramids without using "CS50 library"

I am new to programming and I've only learnt basics of C as far as functions. I decided to solve this problem given in Harvard CS50 course. Please review my code. We had to write a program which takes ...
3
votes
1answer
34 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 ...
0
votes
0answers
24 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 ...
0
votes
1answer
42 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 ...
4
votes
1answer
533 views

PowerShell - fast remove a directory with 10,000+ files

I am sick of File Explorer's super slow deletion speed, so I tried to write a PowerShell script to make deletion faster, and while it does its job, its speed isn't as high as what I intended it to be. ...
3
votes
2answers
164 views

Combination function for a math library in C++

Taking forward the combinatorial library link, I have tried to implement the nCr function. Please mention if this is prone to failing somewhere Any other test code that needs to be added. Any more ...
1
vote
1answer
39 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. ...
4
votes
2answers
490 views

K&R 2-7 - Invert a bitfield from a number

This is my solution to the Exercise 2-7 of K&R C book. The assignment is: Write a function invert(x,p,n) that returns x ...
12
votes
2answers
30k views

Makefile that places object files into an alternate directory (bin/)

I'm trying to learn how to use makefiles, and this is my attempt at making a makefile that compiles source files in a source directory (src/) into object files that are created in a bin directory. <...
1
vote
3answers
79 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 ...
6
votes
4answers
614 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: ...
3
votes
1answer
2k views

William Fractal technical indicator implementation

I'm really new to both Python, data analysis and Panda and for gathering a bit of familiarity with this components and trying to replicate a trading strategy I'm creating a function that give me the ...
14
votes
4answers
3k 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? ...
10
votes
2answers
2k views

Factorial function for a math library in C++

I am trying to code up a basic combinatorial math library for C++. Started with the implementation of the factorial function. Here I include the code and the test code. Please review. Is the way of ...
1
vote
0answers
28 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 ...
5
votes
4answers
181 views

Create a little adventure world

I have just recently picked up coding and am trying to improve my coding. I've written this bit of code to create a little adventure world. I haven't completed the code, everything runs how I want it ...
2
votes
1answer
98 views

Created a basic User Profile List using an API (React)

I'm relatively new when it comes to programming in React and in JavaScript, but have a surface level understanding of what things do. I've created a basic program that fetches user data from an API ...
0
votes
1answer
37 views

Angular observables piping

I wanted to check and see if this was as efficient as can be. The goal is to get a user's data from a group of documents that contains references to users in Firestore. ngOnInit ...
5
votes
0answers
63 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 ...
4
votes
2answers
375 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 ...
8
votes
3answers
348 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 ...
2
votes
0answers
37 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 ...
1
vote
2answers
110 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 ...
3
votes
3answers
102 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 ...
12
votes
5answers
5k views

Kaprekar's constant

I'm new to Python and as a first exercise, I've written a function (module?) to calculate Kaprekar's constant using Python 3. I'd like some feedback on whether this is Pythonic enough, and if I can ...
3
votes
4answers
323 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 ...
-1
votes
0answers
26 views

Saving Functions into Package in Jupyter Notebooks

not sure if I'm phrasing my question correctly but here goes. I've been using Python in a Juptyer Notebook on juptyer hub for one of my class. I've written many useful functions that I want to use to ...
2
votes
2answers
39 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 ...
2
votes
1answer
72 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 ...
2
votes
2answers
98 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 ...
11
votes
4answers
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 ...
4
votes
2answers
116 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 ...
2
votes
0answers
59 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 ...
2
votes
1answer
132 views

Pairwise summation in Haskell

I'm new to Haskell, and I figured that pairwise summation is something I could do easily. I wrote this: ...
4
votes
3answers
649 views

A deque for up to one million elements

I have a task where I need to write my own deque and to this code was executed for 1 second, I get a result of 1.09 sec. The max count of elements is 1000000. How can I optimize it for better ...
1
vote
1answer
38 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 ...
7
votes
3answers
1k 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 ...
3
votes
1answer
4k views

A basic calculator in C that uses a loop

I have created a program that forms a basic calculator in C which includes the basic operations like addition, subtraction, multiplication and division. But in this case I decided to use a Do-While ...
1
vote
1answer
50 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 ...
4
votes
2answers
126 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: ...
4
votes
1answer
108 views

Simple item and inventory system

Items.cs, Creates dictionaries, enumerators, and classes for every type of item. ...
3
votes
4answers
123 views

Verify that 5 Textboxes have some content

I'm new to C#. I have created a form that has 5 text boxes and this function checks to see if every text box has text in the box. If not, then it displays a message box saying "Error (Add Text)...
1
vote
0answers
38 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 ...
4
votes
1answer
74 views

Ansible playbook to install Docker Swarm

this is my first ansible playbook. it installs docker in swarm mode and automatically joins the cluster. could you guys please review my code and show me where it can be improved? ...
2
votes
3answers
52 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 ...
5
votes
1answer
750 views

The sheet music of Morning Mood

While learning to play the keyboard, I find it helpful to write down the score of the pieces I play, regardless of whether a score already exists. The code is written using Frescobaldi as IDE and ...
4
votes
2answers
114 views

DNA Challenge from CS50

Added the problem link below and my implementation of it. Took me a few hours to program. I have added comments to explain my thought process. Problem Link Goal - To implement a program that ...
3
votes
2answers
417 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 ...

1
2 3 4 5
143