6

Nice project, find below my suggestions. Clearing the terminal There are more than 20 System.out.println(" ") in one line and then again a few lines below. Create a method to clear the terminal and shorten the code with a for-loop. There are also other ways to clear the terminal. Duplicated code Requesting the input from the user is duplicated ...


5

The code can be structured better, so the code is more self-documenting. Self-documenting code doesn't need as many comments, which makes it easier on everyone. Comments that aren't there can't be obsolete either. Take input (height) Output pyramid Those are the only lines I want to see in main. The rest should be in functions. You started out nicely by ...


3

"Utility" libraries It's time to take the training wheels off, so to speak. You need to stop using cs50.h and replace it with standard calls to the C libraries. The implementation for get_string has a careful, dynamically-allocated buffer algorithm that is really not necessary for most purposes and can be replaced with simpler calls that use a ...


3

Good start! I like that is_win() and is_lose() are separate functions. They could be improved by returning the boolean directly. In general, if you have code that looks like if condition: return True else: Return False, it can be written as return condition directly. Also, is_lose() can be written as is_win() with the parameters swapped def is_win(computer2, ...


3

Here are my observations: string randomCase: I would suggest to start your method name with a verb and use CamelCase. For example: RandomizeCase (string word): I've got your intent, but nothing prevents the consumer of your API to put a sentence into your word parameter. In such a general purpose method input can be considered as a fine parameter name. ...


3

This entire method should be static, as it clearly does not require an object new Random(Guid.NewGuid().GetHashCode()) is needlessly complicated. new Random() is initialized based on time by default A simpler range from (0,2] can be used. The changed variable can be entirely replaced by a switch and return structure private static string Capitalized(string ...


2

Most of the code in this class just makes no sense and written only because it has been shown in some tutorial as an example for some other class. In case of a database connection class, there is no use for the database credentials' getters. You never need a database host anywhere outside of the database class. Hence, getServername() method will never be ...


2

Your def is_win(computer2, computer1): if (computer2 == "r" and computer1 == "s") or (computer2 == "s" and computer1 == "p") or (computer2 == "p" and computer1 == 'r'): return True could be shorter (and always return a bool, instead of True or None): def is_win(computer2, computer1): return (...


2

This code needs compiling with more warnings enabled: gcc -std=c17 -fPIC -g -Wall -Wextra -Wwrite-strings -Wno-parentheses -Wpedantic -Warray-bounds -Wstrict-prototypes -Wconversion 254841.c -o 254841 254841.c: In function ‘main’: 254841.c:14:13: warning: conversion from ‘int’ to ‘float’ may change value [-Wconversion] money = dollars_to_cents(...


2

UI I noticed that when I add a new task I tried to click on the text "New task" to replace that with the text of the task but then I didn't get a cursor, so then I clicked on the text labeled "Task" and started typing - I could barely tell my text was added but it was black so it was difficult to see it against the black background. ...


1

Your solution does the following: downcase the string convert the resulting string to an array of words reverse the array of words convert each word in the array so that the vowels are at the end and order is preserved for both the vowels and non-vowels join the words in the resulting array to form a string Let's begin with the penultimate operation. To ...


1

BUG: q_init() doesn't return a value. Your compiler should have caught this; perhaps you're running without enough diagnostics turned on? (I think this requires a diagnostic, so perhaps you need a better compiler). BUG: We forgot to copy the terminating null character! for (int i = 0; i < numtest; i++) { q_push(nameq, test[i], strlen(test[i])); } ...


Only top voted, non community-wiki answers of a minimum length are eligible