Skip to main content
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
Results tagged with
Search options not deleted user 40543

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.

4 votes
Accepted

Weather station for a Raspberry Pi

Basic Structure I would recommend creating an Elements class. class Elements(): def __init__(self, day='', date='', low='', high='', weather=''): self.day = day self.date = date …
BeetDemGuise's user avatar
  • 4,116
6 votes
Accepted

Calculating relative strength index over a period

Your code is already pretty Pythonic. There is a bug in your code. If no losses were reported in that window then losses == 0.0 which when you append to rsi will throw a ZeroDivisionError. There are …
BeetDemGuise's user avatar
  • 4,116
8 votes
Accepted

Can my Python maze game be better in any way?

Welcome to programming and Python. I have a few suggestions. There are a lot of suggestions here in this answer. To improve the style of your code beyond the things I have spoken to here, have a look …
BeetDemGuise's user avatar
  • 4,116
2 votes
Accepted

Parsing Solr log files

Since this you posted quite a lot of code, I'll keep my comments higher-level and more general in nature. There is one document titled PEP8 that covers Python's style conventions. Take a look at it a …
BeetDemGuise's user avatar
  • 4,116
6 votes
Accepted

Clean and tidy Python code for dictionary look up and API interactions

I have a few pointers, a lot of them coming from Python's offical style guide: ALWAYS use with syntax when dealing with files: with open('some_file.txt', 'r') as file: # Do stuff # file will b …
BeetDemGuise's user avatar
  • 4,116
6 votes

Splitting company name into 3 strings

Everything in moderation Whitespace can help make your code nice and readable. However, TOO much whitespace can make your code hard to read. You fall into the latter case: you have way too much white …
BeetDemGuise's user avatar
  • 4,116
21 votes
Accepted

Spin-the-bottle-like game

First off, welcome to programming and Python. They are both awesome! Ok, with this being your first foray into coding, instead of giving specific code improvements, I will give some high-level recomm …
BeetDemGuise's user avatar
  • 4,116
3 votes

K-means clustering in Python

Because @jonrsharp commented much of the functional improvements, I'll speak on style improvements. Firstly, take a look at PEP8, the official Python style guide. It holds a lot of beneficial informa …
BeetDemGuise's user avatar
  • 4,116
3 votes

Taking wind data and simulating future wind profiles

I want to speak towards some style and general Python improvements (of which there are quite a few) that you can make. Repeated Code Whenever you have to define a handful of variables that are all b …
BeetDemGuise's user avatar
  • 4,116