Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
30
votes
Providing advice based on user's favourite YouTuber
I've heard of dictionary lookups but I don't really understand what they are so if anyone thinks that they maybe relevant and could show me how to implement it that would be great!
Here you go!
…
23
votes
6
answers
5k
views
Implementing any_of in C++
I've decided to implement Python's any in C++. I've gone about this using templates to allow multiple types of data to be passed, instead of overloading the function multiple times. This is my first t …
16
votes
3
answers
7k
views
2D Collision Detection in C++
I would really appreciate any feedback that is given, as I'm still a beginner when it comes to c++.
This function works as intended. …
7
votes
Accepted
Interactive Discord bot for tabletop RPG
List Comprehension
Instead of
roll = []
for x in range(0, dice):
roll.append(roll_die())
do this
roll = [roll_die() for _ in range(0, dice)]
The result is the same, it requires less code, …
7
votes
Hero battle game
Character.success_check
This method can be reduced to two lines
def success_check(self):
defense = roll_d_x(attack_dice)
return defense >= defender.mobility
Since defense >= defender.mobil …
6
votes
1
answer
2k
views
Snowflakes in C++
I've started learning C++ using Microsoft Visual Studio. I'm decided to create a simple GUI program that creates a "snowflake" wherever the user clicks on the screen. Seeing as how this is my first C+ …
6
votes
Accepted
Find all numbers that are factors of one array and factor into the second array, then print ...
Redundant calculations
You calculate mult1 * mult2 three times. Instead, do this once, assign it to a variable, and use that.
Since you want to never want to calculate when a value is 0, you can set …
5
votes
Accepted
Sim survival game
Wow! What a project!
I had tons of fun working on this! There are a lot of things to like about your code. Instead of going over the general improvements I made, I'm going to explain each part that I …
5
votes
Accepted
A simple Decryption Program using Python
Use built in methods!
Your position_in_alphabets function can be reduced to one line. In fact, replace y = ... with the following:
alphabets.index(character) + 1
index returns the first occurrence …
4
votes
Accepted
Login and Register program
Please indent your code
Taking a first pass it was really difficult to determine where functions ended. While I was scanning it looked like you have random while statements outside your functions. Ind …
4
votes
Accepted
Messy Hangman Game
Just a few possible improvements.
Variable Naming
According to PEP 8, variable names, including parameters, should be in snake_case, not camelCase. This will apply to all the improvements made bel …
4
votes
Accepted
Revised text adventure game with a war theme
Only going to comment on a couple things I noticed while scrolling, not enough time to review the full code.
Be Consistent
Here is your to_win function:
def to_win():
print('85/15 TO WIN', end= …
4
votes
3
answers
359
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 th …
3
votes
Accepted
Python - Password Generator & Strength Checker
Reliability
I get that this program is meant for you to continue learning python, but please don't use any passwords generated by this program. Especially since your strength check is really weak. I.E …
3
votes
Accepted
Text Dungeon in Python
Decision loops
Your implementation of a decision loop is... interesting to say the least. If you're using python-3.8, you can utilize the walrus operator. It's a way to assign variables within an exp …