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
108
votes
6answers
15k views

How clean is my snow?

I just wrote a snow animation in Python. I think this is fairly clean but I have a few things that I don't like. ...
42
votes
3answers
2k views

We'll be counting stars

Lately, I've been, I've been losing sleep Dreaming about the things that we could be But baby, I've been, I've been praying hard, Said, no more counting dollars We'll be counting stars, yeah we'll be ...
38
votes
4answers
5k views

Beheading of knights, who survives?

We have a round table of n knights, where n is some positive integer. These have failed to satisfy the expectations of the mad ...
37
votes
6answers
17k views

Random IP Address Generator

randip.py I know there are probably better, easier ways to do this. It was just a bit of a learning exercise for the sake of familiarising myself with Python. It takes a single argument (positional ...
36
votes
7answers
5k views

Increase performance creating Mandelbrot set in python

I created a program in python that generates an image of the mandelbrot set. The only problem I have is that the program is quite slow, it takes about a quarter of an hour to generate the following ...
35
votes
2answers
4k views

Markov country name generator

I wrote a country name generator in Python 3.5. My goal was to get randomized names that would look as much like real-world names as possible. Each name needed to have a noun and an adjective form (e....
34
votes
5answers
5k views

Beginner's snake game using PyGame

I am a complete beginner when it comes to programming and writing games and this is my first ever game. I made it with python 3 using pygame library. I would ...
34
votes
3answers
2k views

Bush Wanderer - code intended for teaching

I am teaching computing to an AS class and this was their assignment: Bush Wanderer Task 1 Create a 5x5 grid of hashes(#) where the player is an ...
32
votes
7answers
9k views

Tiny image scraper for xkcd.com

This came out on the spur of the moment, as a quick and dirty tool to have the job done. This is a simple image scraper for immensely popular and legendary comic website inspired by a Python Easter ...
30
votes
7answers
6k views

Car crash reaction time

In physics class we are doing an investigation thing. Some of the numbers might seem plucked out of thin air but they aren't. The maths is right(I think) I just want some feedback on the code. ...
30
votes
8answers
5k views

Project Euler Problem 45

As a self-teaching Python beginner for almost 4 months, I have mostly been doing online challenges including Project Euler problems. Problem 45 asks: Triangle, pentagonal, and hexagonal numbers ...
27
votes
5answers
6k views

A first “Hangman” game in Python

I am new to Python (it's my first language), been coding for a couple of weeks now. I have already made a couple of simple scripts to download and manipulate some financial data, but lately I thought ...
26
votes
5answers
5k views

Fishing simulator

I'm new to Python, for a school project I created a "fishing simulator". Basically, it is a use of random. I know that my code is repetitive towards the end, but I don't know how to simplify it. <...
26
votes
7answers
6k views

Python program to calculate GCD

...
26
votes
4answers
2k views

1, 2, Fizz, 4, Buzz: FizzBuzz

I just recently started working on python (interesting language, actually), and, as I always do when I learn a new language (with the exception of BrainFuck, that's too hard), I write a FizzBuzz ...
25
votes
6answers
26k views

Monte Carlo pi calculation

In order to learn the basics of Monte Carlo I calculated pi with it. I also wrote an explanation of the reasoning behind the code. Down here you can see the circle with random points that I simulated ...
25
votes
4answers
7k views

Sieve of Eratosthenes - Python

I've been doing a lot of Project Euler lately and just wanted to make sure my implementation was as good as it could be. Does anyone have any suggestions to speed this up? ...
25
votes
4answers
2k views

Translating from English to Entean

I wrote a python script that converts English to Entean language from an anime called "The Devil is a part timer". I am sloppy at coding and know that the script can be made better. In the anime, the ...
25
votes
2answers
3k views

Send daily email alerts of the Bitcoin Price

My script sends daily alerts of the bitcoin price to my inbox. I am using CoinDesks API, and the following libraries: requests==2.18.4 schedule==0.5.0 and gmail sender: https://github.com/...
25
votes
2answers
1k views

Spin-the-bottle-like game

I've started coding about 3 weeks ago, just for fun and maybe practical uses later. My GF dared me to make a PGM that would replace this dice game where you roll two dice, one with body parts and one ...
25
votes
3answers
716 views

Calculate questions per day on CodeGolf.SE

I wrote a short script in Python 3 that connects to the Stack Exchange API, gets all questions on Programming Puzzles & Code Golf over the past two weeks, and determines the average number of ...
25
votes
2answers
665 views

Telling fibonaccis to the user

Though this program tells the truth (unless you change the source code), it does tell Fibonacci numbers, depending on the user's input. Keeping in mind of all (or most) of the feedback given from ...
24
votes
4answers
3k views

Formatting 3 integers (hours, mins, secs) to `00:00:00`?

I have this at the moment, wondering if there's a cleaner way to do it or if this is already as compact as it gets. ...
24
votes
3answers
567 views

Python review_generator

Given a Python file containing a Python script written with bad style, this script will output a review adressing its problems. ...
24
votes
1answer
1k views

Backpropagation in simple Neural Network

I've been working on a simple neural network implemented in python. Currently, it seems to be learning, but unfortunately it doesn't seem to be learning effectively. The graph below shows the output ...
23
votes
4answers
2k views

My first calculator

I've just wrote my first code, which is basically a calculator. Please rate it and suggest improvements (keeping in mind that I'm a beginner). ...
23
votes
4answers
5k views

Functions to convert camelCase strings to snake_case

I have written two functions, one actual and one helper, to convert camelCase strings into snake_case strings (I call it joint-lower case). Any ideas for improvement are welcome. ...
22
votes
6answers
4k views

Simulating an OOP Coffee Machine

Today I learnt the basics of OOP. I have tried to apply them to this coffee machine project. However I'm still a beginner, and so I feel my code can be improved. Are there any tips, trick or other ...
22
votes
5answers
5k views

Battleships game in Python

The idea is, you enter an amount of ships, for example 10. It will then place 10 ships on a 10x10 grid (0-9). You may enter a coordinate, and it will tell you if it is a hit or a miss. A simplified ...
22
votes
2answers
1k views

Zork-like text adventure w/ Python

I've been using Python for around 3 months and decided to make a simple text adventure game for fun and to exercise a lot of ideas I've been learning about. I've just recently learned about classes ...
22
votes
1answer
2k views

Simple Morse code interpreter

This is a simple Morse code interpreter with a CLI. It's a naive table-lookup implementation, and uses my-py for type checking. It automatically detects the input (English or Morse) and converts ...
21
votes
7answers
6k views

Converting JPG images to PNG

I had a task to convert some JPG images into PNG format using Python. I successfully did it but I was wondering if somehow I could make my code better than my current one. Code - ...
21
votes
3answers
45k views

BFS Implementation in Python 3

...
21
votes
3answers
2k views

Pythons Around the Rose

Based off my Java Petals Around the Rose, I thought it would be good practice to write something again in a different language. Because the language is Python, I named it "Pythons Around the Rose", ...
21
votes
3answers
4k views

Financial website scraper

I wrote the code that would scrap Finviz for tickers and href that attach to the ticker. I tested with multi-page as well as one page. I'm new to python programming and therefore believe my code is ...
21
votes
4answers
6k views

System that manages employee data for managers

This code is for an employee management system. The goal that I am trying to reach is to allow managers to access data of their employees more easily. The data that is entered is saved to a CSV file ...
20
votes
8answers
25k views

Program to check if a date is valid or not

I am a novice programmer and am currently learning Python programming by myself through a book. I stumbled upon a question in a chapter and it took me 2 days to figure out a solution for it. Although, ...
20
votes
2answers
31k views

Turn-based battle simulator

I am embarking on the daunting journey of learning to program on my own two feet and have created a turn-based battle simulator (think Pokémon). The idea came from here. It's very crude and could ...
19
votes
9answers
4k views

Approximating constant π² to within error

This function takes as input float error and approximates constant π² to within error by computing this sum, term by term, until the difference between the new and the previous sum is less than error. ...
19
votes
6answers
6k views

Python function to map True, False, and None to symbols for display

I have a use case in which I need to check whether a given value is explicitly True or False: ...
19
votes
5answers
3k views

Count Even Digits In Number

I was asked to complete this CodeStepByStep problem. Here's a quick summary: Write a function named count_even_digits that accepts two integers as parameters ...
19
votes
6answers
4k views

Premier League simulation

I've created a simulator for the Premier League, which takes in all of the 20 teams and plays them against each other, recording the results and outputting a table at the end. The skill levels are ...
19
votes
4answers
2k views

CodeReview question markdown downloader

This is an update to my earlier question From Q to compiler in less than 30 seconds. As with that version, this Python script automatically downloads the markdown from any question on Code Review and ...
19
votes
2answers
537 views

Newborn pythonic calculator

Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge. Please review the ...
19
votes
2answers
320 views

Select external resource to feed data into a processing function

I wrote an application a while back to plan and manage drones races. (Well, it could be anything with identification numbers going through checkpoints.) At that time, communication between the gates (...
18
votes
6answers
5k views

Explicit song lyrics checker

To stay in practice with my Python I've decided to write an explicit song checker. It checks each word in the song against an array of 14 explicit words contained in the text file. I've decided not to ...
18
votes
3answers
4k views

Password Strength Detector

I'm just a beginner in Python. I wrote a simple code that detects the user's password strength, but I feel that it isn't very efficient. How can I improve it? ...
18
votes
5answers
2k views

Flipping coins performance

This is the Flipping coins problem on CodeChef: There are \$N\$ coins kept on the table, numbered from \$0\$ to \$N - 1\$. Initially, each coin is kept tails up. You have to perform two types of ...
18
votes
4answers
3k views

How can I make this tax calculator cleaner?

I recently created this Income Tax calculator based off your filing status (Single, or Married Filing Jointly) and which tax bracket you fall into for the 2020 tax year, taking into account the ...
18
votes
6answers
3k views

Comma Code - Ch. 4 Automate the Boring Stuff

I am new to programming and currently learning Python using "Automate the Boring" by Al Sweigart. I've just completed the "Comma Code" task in Chapter 4 and would like some feedback on my solution. ...

1
2 3 4 5
81