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
13
votes
1answer
585 views

Simple Python 3 templating module

The module adds syntactic sugar to Python 3 to allow concise specification of templates. I use it to generate a collection of static web pages from various data sources. I wanted something ...
13
votes
2answers
608 views

Sierpiński's carpet fractal animation for teaching Python 3

I am teaching programming (in this case - 1 on 1 tutoring of a teenager interested in programming) and this code will be a final stage of a progression toward program generating a nice image of ...
13
votes
1answer
2k views

Soup of the day: best served during election season

Community moderator elections on the Stack Exchange network are really exciting. Alas, on the page of the primaries, I find it mildly annoying that candidates are randomly reordered on every page load,...
13
votes
2answers
136 views

“Drone Racer” now shipping in your local area

This question is a follow-up of this one; where I present a software to plan and manage drone races. I might come with a new question about the SQL part in a few days as well. The code can still be ...
13
votes
1answer
234 views

Logging library

Due to several limitations of the standard library's logging module, I wrote my own. Below are the most important parts. You can find the whole library here. Any feedback is welcome. ...
13
votes
1answer
281 views

Population dynamic simulation on biological information maintenance 2

This question is the follow-up to this previous question. Background Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
13
votes
2answers
5k views

A website status monitor in Python/Flask

I've written a basic website status checker in Python/Flask which reads a list of URLs from a json file and cycles through them every x seconds to check they're online. It displays the results as a ...
12
votes
4answers
5k views

Inserting robot moves into an SQLite3 database

I'm just wondering if you would consider this to be safe from SQL injection. A peculiarity of my program is I need to dynamically access table names depending on my scenario. This is not for ...
12
votes
6answers
10k views

Python Code for List of Month Names starting with current month

I am looking for a cleaner, more pythonic way to get a list of the name of the months starting with the current month and ending 12 months later. For example, it's December so my list should be <...
12
votes
4answers
2k views

Shop system for an RPG in Python

I built a shop system for a Python text RPG I'm making. It repeats itself more than I would like. I was thinking I could use dictionaries to make it better but I'm not sure how. Anyways, how is it? ...
12
votes
3answers
8k views

Python shuffle the middle letters in all the words of a sentence

The purpose of the program is to shuffle only the middle letters of each word in a sentence, leaving it still readable like this: Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't ...
12
votes
2answers
2k views

“Longest Collatz sequence” in C slower than in Python 3

This tight-looped memoization-less C solution to Project Euler's problem 14 seems efficient, but ran much slower than a similarly trivial Python 3 program. For the desired ...
12
votes
3answers
3k views

Converting Roman numerals to integers

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. ...
12
votes
3answers
11k views

Pokemon Turn Based battle (Python)

This is based off the popular Pokemon Turn Based project (here). GOAL Write a simple game that allows the user and the computer to take turns selecting moves to use against each other. Both ...
12
votes
6answers
4k views

Python 3 - Fibonacci Implementation

I wrote a function returning the n-th Fibonacci number in Python 3: ...
12
votes
3answers
2k views

PyDOS shell simulation

I have a big project called 'PyDOS', written in Python 3.4, and it's going very well. Post your answers of anything that could make it look cleaner. ...
12
votes
4answers
2k views

Comma Code - Automate the Boring Stuff with Python

Below is my code for the Comma Code problem from Chapter 4 of Automate the Boring Stuff with Python. Is there anything I can do to make it cleaner? Comma Code Say you have a list value like this: ...
12
votes
4answers
5k views

Text Adventure Game in Python

I'm currently working on a text adventure game for my first project. I am a beginner so I am seeking help with my code. Please comment any tips and general help regarding with making my code better, ...
12
votes
3answers
8k views

Python password manager

I am writing a python password manager, and I know there's a lot of scrutiny that goes into storing passwords (don't worry, mine aren't plaintext). I was hoping that this community could help me ...
12
votes
2answers
2k views

Simple Python turn based battle game

As I mentioned in my bio, I do not code for a living and too old to switch careers but I do enjoy it as a hobby and I am trying to get better. Also trying to get my teenage son more interested. Anyhow,...
12
votes
3answers
3k views

Printing Command Line Unicode Chess Board

Let me preface this by detailing some of my design philosophy. The intent is to view the board from the perspective of the active player. Player moves are also factored into the design. When ...
12
votes
5answers
2k views

Printing every 10th result in an alternating ± series

Problem: In the following expression 1-2+3-4+5-6 ... -98+99-100, print result every 10th (10, 20, 30, ...) calculation. My code: ...
12
votes
3answers
4k views

Python π = 1 + (1/2) + (1/3) + (1/4) - (1/5) + (1/6) + (1/7) + (1/8) + (1/9) - (1/10) …1748 Euler

I wrote this code to show that my reddit post is correct. After the first two terms, the signs are determined as follows: If the denominator is a prime of the form 4m − 1, the sign is positive; if ...
12
votes
2answers
2k views

Tower of Hanoi Recursive Implementation using Python with OOP

I have just finished a small program for Tower of Hanoi using recursion. I did it to practice OOP which I recently learnt. It took me about 2 hours to research about the recursive algorithm and write ...
12
votes
3answers
2k views

Worded Mastermind game in Python

Just completed a /r/dailyprogrammer challenge. Challenge #238 to be precise. A Github repository with the wordbank.txt is available here. ...
12
votes
3answers
19k views

Simple chat bot

I made a chat bot, that, as you talk to it, it learns to respond. But the way it speaks is strange, so if you have any ideas on how to make its response any more human, then please say so. Anyway, ...
12
votes
5answers
1k views

Find all words that satisfy unknown letters (Hangman)

I have been working on a function which might be used to solve a word game like Hangman or "Wheel of Fortune". Basically, I wish to search from a very large ...
12
votes
4answers
19k views

Simple budget program

I've decided to start working on a budget application for the purposes of enhancing my Python skills. In its current form this program takes given expenses and income and tells the user whether they ...
12
votes
2answers
891 views

Python algorithm that converts array-like data into MathJax

I frequently use MathJax, and often I need to write matrices. Since writing matrices using MathJax is very tiresome task, I decided to automate it. Code: ...
12
votes
2answers
2k views

Script that helps people make better choices

This is a "Help me make a choice" script where the user can input two options and then, based on the (3) reasons why they are good options, and the reasons weight the script will tell you which option ...
12
votes
4answers
97k views

Simple game of Hangman

On my quest to become a master programmer I have created a simple game of Hangman, and so I thought I would upload it here and see how it could be refined. One question I had was my use of exception ...
12
votes
4answers
2k views

Reverse Polish Notation (RPN) Calculator

I am trying to solve a codewar challenge (link): Your job is to create a calculator which evaluates expressions in Reverse Polish notation. For example expression ...
12
votes
1answer
1k views

Print the string equivalents of a phone number

Task Old mobile phones had the ability to type characters by pressing a number. The letter a could be typed by pressing 2 once. ...
12
votes
2answers
17k views

ASCII-fication of playing cards

I am making a small Blackjack game in Python 3. The part of the code I am unsure about is that which allows me to print nice ASCII versions of the card. ...
12
votes
2answers
2k views

CodeFights: Pipes game

Description Carlos always loved playing video games, especially the well-known computer game "Pipes". Today he finally decided to write his own version of the legendary game from scratch. In ...
12
votes
3answers
2k views

Basic Sudoku Solver

For my programming class I had to make a sudoku solver. ...
12
votes
2answers
853 views

A minimal CLI password storage and retrieval manager

Its primary function is to retrieve+copy a PW to your clipboard. It'll also add, update, delete key/value(accountName/password) pairs from a JSON formatted dictionary(separate .txt file). It's ...
12
votes
3answers
588 views

Computing the n-th prime

I've written some Python 3 code that computes the \$n\$-th prime. I implemented first a naive isprime function that looks for divisors of \$m\$ between \$2\$ and \$\lfloor \sqrt m \rfloor+1\$. Then a ...
12
votes
3answers
796 views

Raspberry-Pi morse-code LED

I am new to programming, python and raspberry-pi, but I am keen to learn more. After doing a few basic tutorials I though it might be best to give it a shot and just come up with a task in which I ...
12
votes
1answer
1k views

Python program that draws the Mandelbrot set fractal

I wrote a Python program that draws the Mandelbrot set fractal. However, the program is very slow. I would appreciate any feedback on the program, but I would especially appreciate feedback on how to ...
12
votes
4answers
3k views

n-queens puzzle in Python

I want to increase the efficiency and reduce the time complexity for the n-queen problem in n*n matrix chess. I am able to run only still (11*11) in normal time otherwise for the big number it is ...
12
votes
1answer
2k views

Flatten an array of integers in Python

The goal is to flatten an array of nested arrays of integers. For example [1, [2], [3, [4]]] should return [1, 2, 3, 4] I'm ...
12
votes
2answers
6k views

Boggle board game solver in Python

I have written a Boggle board solver in Python 3. I would like comments on readability and structure. Thank you! Boggle Boggle is a board game with a 4x4 board of squares, each of which has a letter,...
12
votes
1answer
555 views

Bratwurst.py - A helper program for a cashier

I am a student in Germany, more specifically in Bavaria, and here we use to have a so-called "Kirwa", an event for celebrating the establishment of the local church - technically that's the ...
12
votes
1answer
2k views

Multiple dispatch decorator in Python

I've written a decorator for easily creating multiple dispatch functions: ...
12
votes
1answer
13k views

Scraping the full content from a lazy-loading webpage

I've written a script in python in combination with selenium which is able to scrape 1000 links from a webpage in which lazy-loading method is applied for that reason it displays it's content 20 at a ...
12
votes
2answers
13k views

File selection button for Jupyter notebook

Background This is a feature that I have wanted to see in Jupyter notebook for quite some time. I'm sure that others have built similar things but I haven't been able to find them on SO, Github, ...
12
votes
1answer
724 views

Fractal rendering fun time

I wrote up a script a while back to let me play around with fractals. The idea was to have direct access to the script that creates the fractal. None of that close, edit, then run hassle; just edit ...
12
votes
2answers
2k views

Python Port Scanner 2.1

I made lots of changes to the script presented in my previous question. I was tempted to edit that one with the new code, but it would invalidate @200_success's helpful answer. It was also ...
12
votes
1answer
890 views

Predator-prey simulation

I made a random-walk predator-prey simulation that focuses on individual animals instead of the (maybe) more common array-based approach. I'd like to hear your opinion about this: how could the ...

1 2 3
4
5
92