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.
3
votes
Accepted
another first tic-tac-toe game
Returning true and false
In your generate win conditions function, instead of returning true or false if the condition evaluates so, simply return the expression; as this evaluates to a boolean anyway …
2
votes
Account signup/login program in Python
Help the user!
When I ran your program for the first time, I wanted to create an account, but I got an error that the file did not exist currently. Now, you wouldn't want your users to create their ow …
2
votes
Rock Paper Scissors with file save/load
Input Checking
I'm going to comment on this first, since the bulk of your code is basically checking user input, over and over again. The simplest way to remove any doubt, and any specific checking, i …
2
votes
Advent of Code 2022 - Day 3
Type hints
Use type hints to clearly display what types are accepted by a function, and what types are returned. Disclaimer: These type hits are written using Python 3.11, so you might need to update …
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 …
1
vote
1
answer
835
views
Printing one to ten in (GAS/AT&T x86/x64) assembly
I've started my journey of learning assembly on my Mac. As a start, I've decided to write a program to print the numbers one through ten to the console, then a final string signifying the end of the p …
3
votes
Accepted
Python Battleship
I see that you tagged the question as beginner, so I'll cut you some slack. …
3
votes
Accepted
Hangman Game from OCW MIT 6.0001 Pset No. 2
I'm going to go function by function and explain what I changed and why.
Imports I used:
from typing import List
load_words
def load_words() -> List[str]:
"""
Returns a list of valid words. …
3
votes
Accepted
text-based RPG game in python- character selection
Naming
I would make the following changes
w() -> remove
t() -> print_text()
Since w() is just time.sleep, it isn't necessary. And someone looking at your code would understand time.sleep a lot after …
1
vote
Simple blackjack game using OOP
Blackjack.hit_or_stand
This function can be shortened to the following
def hit_or_stand(self):
while decision := input("(hit/stand h/s): ").lower()[0]:
if decision in 'hs':
ret …
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 …
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 …
1
vote
Beginner Hangman Game
Getting lines from a file
You can use simple list comprehension to get all the lines from a file.
words = [word for word in open("dictionary.txt", "r")]
However, this does not ensure the file will …
1
vote
Check whether a permutation with one fixed point can be rotated into one with two fixed points
You're checking way too much in your program. In your test function, the all is going through every single element in the list and checking if it's True. What you should do is do the check yourself, a …
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 …