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 47912

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.

5 votes

Python 3.6+ function to ask for a multiple-choice answer

I think that 200_success already covered most points. I would however like to add an alternative idea for the printing part: print("Enter the number of your choice -", *(f'{i}. {opt}' for i, opt …
magu_'s user avatar
  • 938
15 votes
2 answers
1k views

Project Euler #22 - Names Scores

I programmed Problem #22 from Project Euler in Python. It works but I want to know if it really is pythonic enough. Using names.txt (right click and 'Save Link/Target As...'), a 46K text file co …
magu_'s user avatar
  • 938
5 votes
1 answer
970 views

Hints to make Sudoku solver more Pythonic

As you will see, I am not very familiar with Python and NumPy but want to learn it. The following code is a very basic Sudoku solver which works fine for simple examples. Although it runs, I still ha …
magu_'s user avatar
  • 938
1 vote
1 answer
95 views

Hints to make Sudoku solver more Pythonic (II)

I tried to implement as many changes suggested as possible as well as expanding the code base according to the suggested link. The original question can be found here. It does solve 4x4 and 9x9 Soduku …
magu_'s user avatar
  • 938
4 votes
1 answer
4k views

Class decorator in Python to set variables for the constructor

I personally don't like the boilerplate of most __init__ methods: self.a = a self.b = b ... So I thought this would be a nice opportunity to learn a bit more about decorators. As this is my first a …
magu_'s user avatar
  • 938
1 vote
1 answer
277 views

Write binary save file in Python

I'm fixed on the save file format. There are only three types of data: long (NumPy int32 array, independent of platform) double (NumPy double array) string (UTF-8, but ord(c) < 128 for all character …
magu_'s user avatar
  • 938
19 votes
2 answers
35k 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 inexperienced with file management in Python, I'm sure there is lot of room …
magu_'s user avatar
  • 938
7 votes
1 answer
119 views

Asynchronous recorder

A recorder to asynchronously record both scalar data and images and then synchronize them. The images should be cut with dynamics ROI. Here's my attempt on it. Please feel free to comment upon it …
magu_'s user avatar
  • 938
5 votes
1 answer
158 views

Project Euler #10 in Cython

I'm trying to teach myself some Cython. To do so, I use Project Euler #10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. 2 Find the sum of all the primes below two million. My Cython …
magu_'s user avatar
  • 938
2 votes
0 answers
266 views

asyncio with live update and abort capabilities

This is my first shot at asyncio. I'm looking for any pointers you might have. Especially: Are there any race conditions? This code doesn't scale as expected. In my project I need to call caget 4k t …
magu_'s user avatar
  • 938