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
4
votes
2answers
30 views

Calculate the Degrees of a Clock Hand Based on Input Time

I'm a novice programmer. I started with Java years back and now mostly use VBA to automate tasks for my internships. I want to graduate from VBA and get into Python/R to properly automate tasks. The ...
11
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 ...
-5
votes
0answers
14 views

Python text input [closed]

Is there a way in Python to do text input in input in Chrome (or any browser) For example... str = input("What do you want to spam with?") and in the browser, ...
5
votes
4answers
137 views

Check whether a permutation with one fixed point can be rotated into one with two fixed points

A friend gave me the following riddle: Given n people with n distinct names, you place n names tags on a round table with n seats. If the n people now sit at those seats randomly such that exactly ...
2
votes
1answer
44 views

Parse org-mode clocktable CSVs into time sheets

For my student job, I have been logging work times with the org-mode in emacs for quite some time. Now since I can only work from remote, I figured it would be nice ...
5
votes
1answer
33 views

Remote to remote copying of files

I've written a function to copy files remote-to-remote using SCP command, paramiko, pexpect, and paramiko-sftp. I want to make my code efficient; I'm new to Python and I don't know how. Here's my ...
3
votes
2answers
70 views

Simple Python and SQLAlchemy Text Password Manager

Out of boredom, I decided to start my personal project and I've chosen a simple Text Password Manager. Note: For anyone out there, I strongly recommend you NOT to use this for any sensitive storage ...
4
votes
1answer
43 views

A self contained parser generator implementation

This is a recreational project, I was trying to make a parser generator with a grammar inspired from: https://docs.python.org/3/reference/grammar.html Unfortunately, understanding that specific ...
4
votes
3answers
520 views

Check header files for namespace usage

To ensure there are no naming conflicts within our project (C++) I was tasked with writing a python script to check all of our header files for any occurrences of a ...
3
votes
1answer
28 views

Name Mashup Program Improvement in Python

I am learning python and trying to solve different problems i came across this program which is name mashup which is in Get Programming:Learn to code with Python. problem statement: Write a program ...
-2
votes
0answers
22 views

Vending Machine Project - Python OOP [closed]

I have been working on a vending machine project which is outlined below. After selecting 'b' in the first menu, I am having trouble with comparing the selected item cost with the total amount ...
2
votes
1answer
77 views

Web scraping using selenium, multiprocessing, InstagramBot

An Instagram Bot which downloads the posts from profile I have to mention my previous posts: Instagram scraper Posts (Videos and Photos) Scraping Instagram with selenium, extract URLs, download ...
2
votes
1answer
30 views

Instagram Scraping Posts Using Selenium

Python script that can download images and videos of the user, like Gallery with photos or videos. It saves the data in the folder. How it works: Log in in instragram using selenium and navigate to ...
6
votes
2answers
544 views

Nearest Neighbor Algorithm (general nearest, forward-nearest, or backward-nearest)

I am trying to write an algorithm that can find user-specified nearest neighbors. By user-specified, I mean that the user can specify whether it's a general nearest neighbor, a forward-nearest ...
0
votes
0answers
27 views
+50

Inserting data from client-side to MySQL via Flask-Sqlalchemy

I am creating a Bill of Materials (BOM) web app with flask as a backend. As a part of this app I am inserting data into BomStructure table from ...
1
vote
0answers
26 views

Making a priority queue using a Heap. Without using queue or heapq

I have to implement a priority queue using a heap without any library / package for priority queue or heap. I made a BinHeap class which is a min heap, and I made a priority queue class with enqueque, ...
2
votes
2answers
56 views

Recursing function to create dir in python

I am trying to write a small function to safely create dir until dir until full path of file exists. I'm trying to do it in a recursing function and would love to get some feedback. ...
1
vote
1answer
26 views

Finding data relations of json paths in python

I am kind of new to python, so I am pretty sure there are way better elegant ways to do this. I have made a function that is able to compare two list of possible json object paths, and detect what ...
0
votes
0answers
17 views

Generate a ColumnDataSource for a bokeh histogram hover displaying the names of the units in each bar

I came up with the following setup_cds function as a solution to my own SO question. My question is: how could I improve it (especially the joining of the names ...
0
votes
2answers
62 views

Read .csv files and convert the rows into dict for looping

This script tries to parse .csv files and returns an iterable object to fetch one row at a time to do some process. It works fine but I think it needs improvements ...
3
votes
1answer
41 views

Python implementation of Kahn's Algorithm

Please provide any suggestions on the below code for Kahn's algorithm. Can it be implemented in a better manner, or be improved: ...
6
votes
2answers
101 views

Compressing large jpeg images

I'm working with thousands of large image files in a regularly updated library. The following script does the job (on average reduces my file size ~95%) but costs me around 25 seconds to compress one ...
1
vote
1answer
26 views

Customized method for dataframe in my analysis module

Please download the file and save in home directory and extract it: https://www.dropbox.com/s/swtw8bk35zr1i6d/analyse.7z?dl=0 I can get some warrants info. ...
4
votes
0answers
33 views

Automatically encrypting text editor

I have written an automatically encrypting text editor (github link). The reasons that I wrote this program instead of using vim + gpg are: It's more convenient than vim + gpg (user only needs to ...
2
votes
1answer
20 views

Join ArcGIS tables in Python of plant greenness in response to prior month's rainfall

I am using Python 3.8 with ArcGIS Pro 2.5. This code creates a joined table where I match values for plant greenness in the current month with rainfall X number of months into the past. Each loop ...
4
votes
1answer
67 views

Code for wireless communication work

I need some pointers on how I can speed up my code, as of now it is incredible slow for larger inputs. The way the code works is that the file Loc_Circle_50U.txt contains the true locations of 50 ...
0
votes
0answers
12 views

Simple two-mode camera for graphics engine

I have a camera class that I use with my graphics engine prototype. For context, the graphics engine is written in OpenGL(4.1) using Qt-bindings (PySide2), since I also used Qt as my window and ...
-4
votes
0answers
15 views

Python Caesar cipher encryption [closed]

I have the majority of the code done for the encryption of the input and shift. I'm at a complete loss when trying to implement the capital letters to re-wrap around after trying to go beyond Z. Here ...
3
votes
1answer
216 views

USACO Arithmetic Progressions

The problem I'm solving is: given a length of an arithmetic progression, and a limit to the terms (see below), find all progressions that work. All terms of the progressions must be of the ...
1
vote
3answers
47 views

Scraping the Bundesliga table and saving it to CSV

Wrote my first mini-script to get data from the german football league table and save the data to a csv file. Do you like the approach or could I be more efficient? Thanks in advance! ...
-3
votes
0answers
17 views

How to find the sum of numbers in a list when a particular element in the list is found using for loop [closed]

I have been trying to find if an element exist in a list and sum the values of the elements before the exact element is found using for loop or while loop it seems hard in python. ...
-6
votes
0answers
32 views

hello world!!!- ANY WAY TO OPTIMIZE GIVEN CODE [closed]

`print('hello world') print('hllo word') print('helo Wrld') print('hell orld') print('helloworld')` OPTIMIZE THE GIVEN PROGRAM
0
votes
0answers
8 views

Execute command using `asyncio.create_subprocess_shell` and yield lines of stdout, stderr and finally the return code

My task is to run a subprocess using asyncio.create_subprocess_shell and yield the lines of output. I am using asyncio to avoid ...
-3
votes
2answers
43 views

How Do I Use Subtraction on a List? - Python [closed]

When using lists to store information, how does one perform math on it? No in a (list * y) sort of way or a a = (list(3)+list(4)) sort of way. Instead, something like this: List = [1, 2, 3, 4, 5, 6, ...
5
votes
1answer
720 views

Word jumble game

I took my basic Word jumble game and added some additional features to learn new stuff. My plan was not to have any pre-defined words coded in my python script but rather different group of words in a ...
1
vote
0answers
14 views

Simple Json log Parser Application

I had a coding assignment task(interview) for a senior data engineer role, JSON data validation. Every record in the input json indicates a customer record, I need to write a script to validate that ...
1
vote
1answer
47 views

Python prime finder

I wanted to try and learn multi-threading, so I thought it would be good to make a small program normally first and make it multi-threaded, so I made this prime finder. ...
3
votes
3answers
153 views

Given an array, find all its elements that can become a leader

I was successful in solving a challenge in codility, but my solution failed performance tests. How can I improve my solution? Challenge: Integers K, M and a non-empty array A consisting of N ...
8
votes
2answers
324 views

Navigate objects from a path provided as a string

Recently I wrote a validator for some objects. To increase usability the validator gives the user hints on how to fix some of the found issues. Since the application is around something programmatic, ...
1
vote
1answer
85 views

Printing the last two digits of an exponential calculation

I am trying to create a program where a user inputs two numbers - a base and an exponent, while exponent is a binary number. Then prints out the last two digits of the result. My code is working well, ...
-4
votes
0answers
22 views

STRING REVERSAL in PYTHON ( without using inbuilt functions) [closed]

WHAT IS WRONG WITH THE FOLLOWING CODE? IT' GIVING AN ERROR : STRING OUT OF RANGE ...
-2
votes
1answer
31 views

Python code refactor to use multiprocessing [closed]

I have written some Python code that opens files one by one, does some work, and writes data onto the filesystem. I figured, I want to make use of my cores.I've refactored the program into this. <...
2
votes
1answer
61 views

Find the Percentage from HackerRank

I am learning python by solving python module from HackerRank. This problem is Find the Percentage. You have a record of N students. Each record contains the student's name, and their percent ...
1
vote
0answers
30 views

Advent of Code 2019 Day 3: Crossed Wires

On a Manhattan grid, find the intersection of two paths closest to the origin. input_3.txt can be found here and the prompts can be found in the original problem ...
2
votes
1answer
35 views

Nested Lists from HackerRank

I am a beginner in python. This is the Nested Lists problem from HaackerRank. Given the names and grades for each student in a Physics class of N students, store them in a nested list and print ...
4
votes
2answers
437 views

PDF page & word count, recursive searching of directory tree, output to excel

I wrote this program as part of a work-related problem but with a focus on improving my Python skills. The program was needed to do a word count PDF files. The problem was there were a large number of ...
3
votes
1answer
50 views

A geometry Sector Solver, Value finder for my calculator's micropython

I made a program for my calculator for A levels that acquires the value of the angle and radius of a sector and gives: Area of Sector Area of inner Triangle Arc Length Chord Area Chord Length Sector ...
3
votes
1answer
48 views

Grokking the basics of BlockChain with Python

As I was streaming I had a brilliant visitor suggest we write a blockchain in Python. So we did. Note that there is no validation or voting simulated here. Here's the results, in ...
2
votes
1answer
62 views

Manual Regression Tree using Python

I wrote a code to create a regression tree for a synthetic train data of size Np. The idea is, first I have the source node (which consists of all set of points) ...

1
2 3 4 5
78