Questions tagged [python-3.x]

Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008. Use this tag along with the main python tag to denote programs that are meant to be run on a Python 3 interpreter only. Do not mix this tag with the python-2.x tag.

Filter by
Sorted by
Tagged with
15
votes
2answers
6k views

Evaluating arithmetic expressions

I have written some simple code for evaluating expressions. However, I am not sure how well I am following conventions (this is my first time trying to). Specs for problem: All binary operators (+, -...
15
votes
1answer
2k views

Trie implementation in Python

I have created a trie in Python and am looking for feedback. Specifically, I am looking for feedback on: If my code is 'pythonic' If my logic is proper when inserting and retrieving from the trie I ...
15
votes
2answers
3k views

Condorcet voting method in OOP Python

For learning purposes, I made this little class which determines the Condorcet winner of a rank voting election (basically, a Condorcet winner is a candidate that would beat every other candidate in a ...
15
votes
1answer
446 views

Warhammer: How many of my attacks will succeed?

Me and a couple of mates sometimes play a game called Warhammer. When playing the game you have options of what each model attacks. This can lead to situations where you know if you shoot with 100% of ...
15
votes
1answer
353 views

Modeling a Mage character from nWoD, using Django

Goal Design a representation of a mage character from the World of Darkness RPG, as well their associated spells. Here is a visual representation of the schema. You can see it more closely on ...
14
votes
5answers
7k views

Yu-Gi-Oh cards in Python 3

I made a project in Python 3.7.1 that includes classes to create Yu-Gi-Oh cards. This isn't the entire game; it is just the cards itself. I will create the entire game later. I want feedback on how to ...
14
votes
5answers
35k views

“Guess the Number” game in Python

I have been using Python 3 to learn programming, and this is a very basic task, but I want to gain good programming patterns/habits at the very beginning. The program will first randomly generate a ...
14
votes
4answers
4k views

Password generator in python

Here's a password generator I created. ...
14
votes
5answers
40k views

Chi Square Independence Test for Two Pandas DF columns

I want to calculate the scipy.stats.chi2_contingency() for two columns of a pandas DataFrame. The data is categorical, like this: ...
14
votes
4answers
3k views

100-doors puzzle

Here is a very simple solution to the 100 doors challenge You are in a hotel with 100 doors. Initially every door is closed. On the first round, you change the state of every door (if it is open, ...
14
votes
3answers
2k views

Implementations and analysis of my python login system (~80 lines)

I wrote this login system in the evening and i would like to know what should I fix / change, if should I use classes and, about readability, if this code is OK. I'm a begginer in coding so made this ...
14
votes
3answers
4k views

Python 3 - simple temperature program

I have been teaching myself Python (as well as Tkinter) and today one of the sites I was reading, asked us to write a program to covert one value from Fahrenheit to Celsius, once - an easy three line ...
14
votes
3answers
3k views

Compute the next occurrence of Friday the 13th

How can I get the date of the next occurrence of Friday the 13th? Below is my attempt. It returns the correct results. I think there must be a better way of writing this without checking ...
14
votes
2answers
3k views

Drink order program

I'm looking to improve my code to make it more efficient, such as shortening it but continuing to gain the same output, or to add some more complex functions into the code. ...
14
votes
2answers
9k views

Unbeatable Tic-Tac-Toe program seems difficult to read

I've made an unbeatable Tic-Tac-Toe in Python 3.3. While it truly was unbeatable, it was an eyesore to look at and nigh impossible to read. That code is here. I have since then optimized it for ...
14
votes
2answers
819 views

VIM colors downloader in Python

Recently, I wanted to change my vim colors to something new. So I went to the vim colors website and then I decided that I wanted to download ALL the colors. So I ...
14
votes
1answer
279 views

Recover flights from found tickets

I just found a whole bunch of plane tickets that only have a start and destination on them. I also know the route started in a certain city. I would like to recover the (alphabetically) first possible ...
14
votes
1answer
2k views

Merge n sorted iterators

Over the weekend I was curious about efficiently merging multiple sorted iterators together, and for them to be in sorted order. This is quite like a challenge on HackerRank: You’re given the ...
14
votes
1answer
2k views

Maze generator & animator in Python

This is a follow up to this code and I still did not get the feedback on the drawing functions Maze generator in Python- Gif animator-Custom colors/sizes The code generates custom color and size ...
14
votes
4answers
4k views

Hangman in Python 3

I started learning Python a couple of weeks ago and decided to make a game of Hangman. Some of the features: Take in player name Allow them to pick and change difficulty level Play again when the ...
14
votes
1answer
772 views

Script to load the ISS location and data

I wrote a script to fetch the location for the ISS using two simple APIs. This is my first time writing a python script. Any advice or modifications would be highly appreciated. How is the code, and ...
14
votes
2answers
637 views

Blackjack with card representation visuals

To try and practice OOP, I've heard making a blackjack game can be really helpful; which it has been. I don't know how 'advanced' an implementation this is; but it has all the standard features, like ...
13
votes
5answers
6k views

Transform dollars in exact change

The program was to turn an integer into exact change and uses a bunch of if statements. Are there steps a beginner like me can do to remove some or is it just how it will be? I can't find anything ...
13
votes
5answers
2k views

Optimizing Project Euler #12 (Python 3)

I just figured out Project Euler problem #12. I'm still really new to Python, so I'm putting my code up here in the hopes that someone will be able to give me some tips for optimizing my code to run ...
13
votes
5answers
43k views

Simple countdown programs to print “3, 2, 1, Action!” using while loop

My program is a simple while loop making a countdown starting from 3 and shouts "Action!" upon reaching zero and then breaks. I would like to know which of the following ways is better in means of ...
13
votes
3answers
2k views

Prime sieve in Python

I was trying to write Sieve for the first time and I came up with this code: ...
13
votes
4answers
2k views

Basic Blackjack game in Python

I've only been learning Python for a few days after a Humble Bundle book sale, but I made a functional Blackjack game on which I'd like some constructive criticism as far as my coding structure and ...
13
votes
4answers
29k views

Simple text RPG in Python

I am trying to teach myself to code using Python. The following is the first real program I have written from scratch. I feel that it is messy and in need of improvement, but I am either unsure of ...
13
votes
2answers
2k views

Create the English word for a number

I cobbled together a function from various sources that takes an integer and returns it as its respective English word formatted as a string. The function is as follows: ...
13
votes
5answers
8k views

Cleaning up date strings in Python

Working from a CSV of about 14.000 lines, I need to match dates in the CSV against some API. I'm reading the CSV using Pandas (for various other reasons). Most often, the date is just a year, i.e. an ...
13
votes
7answers
6k views

Comma Code - Automate the Boring Stuff

I'm currently working through an exercise of Chapter 4 from Automate the Boring Stuff, which reads as follows: "Say you have a list value like this: ...
13
votes
5answers
4k views

A Simple Battleship Game

I have just finished learning basic-intermediate Python subjects and wanted to test myself. This Battleship game is the third game i have written. ...
13
votes
2answers
4k views

Average spam confidence

Exercise 7.2 from Python for Informatics: Write a program to prompt for a file name, and then read through the file and look for lines of the form: ...
13
votes
5answers
8k views

“Algorithmic Crush” problem hitting timeout errors

This is the HackerRank problem Algorithmic Crush: You are given a list of size N, initialized with zeroes. You have to perform ...
13
votes
4answers
972 views

Account creation and log-in system

I've been learning Python for about 1 - 1 1/2 weeks now and just finished my first small project to help solidify what I've learnt. It's a very basic (bad) login / create account system that I run in ...
13
votes
2answers
4k views

Reimplementing Python's enum.auto() for compatibility

In Python >= 3.6 there is an enum.auto() function. The auto() function can be used like this: ...
13
votes
3answers
4k views

Leetcode Two Sum code in Python

Here's my solution for the Leet Code's Two Sum problem -- would love feedback on (1) code efficiency and (2) style/formatting. Problem: Given an array of integers, return indices of the two ...
13
votes
4answers
4k views

Check if one string is a permutation of another using Python

The code below is an attempt at a solution to an exercise from the book "Cracking the Coding Interview." I believe that the worst case time complexity of the code below is \$O(n)\$, where n is the ...
13
votes
2answers
3k views

Fishy: An ASCII Programming Language

I've decided to write a very simply output programming language. All the user does is write ASCII values inside ASCII fish, and the interpreter pieces the values together and outputs them. I'm mainly ...
13
votes
2answers
1k views

Mean π: Archimedes vs. Gauss - π computation through generalized means

I've written this simplified code to compute Pi for educational/demonstration purposes. These methods are based upon the generalized means: see a presentation on Pi and the AGM. Archimedes' method ...
13
votes
3answers
1k views

Basic Blackjack program in Python

So in my quest to learn coding while having very little formal training has got me here. I am trying to learn the OOP concept and this is my first proper attempt at using OOP. Can you guys point out ...
13
votes
3answers
4k views

Create dictionary with default immutable keys

I've created a dictionary subclass with a set of default immutable keys. ...
13
votes
2answers
27k views

Simple backup script in Python

Since rsync lacks compression and I'm not a big fan of rdiff, I thought I'd try my own little backup script. Since I'm very ...
13
votes
3answers
3k views

Simulating a river ecosystem

I'm currently working my way through a textbook to enhance my beginner Python skills (Goodrich, Data Structures and Algorithms in Python). The first, somewhat in-depth problem involving OOP was the ...
13
votes
2answers
848 views

Beginner Coin Flip project

I think I finally finished a small coin flip project I found online. However, I'm pretty confident this is far from the optimal solution and would really appreciate any feedback on how this could be ...
13
votes
1answer
640 views

Cactus Reborn - A game engine for text-based adventure games

I'm currently working on reincarnation of the Cactus project, Cactus Reborn, and I've gotten the basic implementation so far. At this point, you can create simple, playable games. There are currently ...
13
votes
1answer
366 views

A Pythonic implementation of Conway's Game of Life

I've just finished implementing Conway's Game of Life in python-3.6: ...
13
votes
3answers
2k views

AniPop - The anime downloader

Note: The topics of performance and Selenium/BS4 have not yet been addressed, so this question can still receive a better answer! Chat Room: https://chat.stackexchange.com/rooms/100275/anipop-...
13
votes
2answers
8k views

Python ASCII-Art Text Generator

...
13
votes
2answers
382 views

Year 0: Instruction Follower

Having played Human Resource Machine for over a day, and wanting to improve my interpreting / tokenizer skills, I made a Human Resource Machine interpreter. For those that do not know, so if you do ...

1 2
3
4 5
92