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
1 vote
0 answers
26 views

Program for monitoring file in Combined Log Format

After encountering a suggestion that monitoring a log file for a webserver could allow for the implementation of automatically analyzing and handling of certain events (that might require altering ...
user avatar
0 votes
0 answers
36 views

Television and channel modelling [closed]

I wrote a simple project to train my beginning knowledge of OOP. My class represents a Televisor that has two types of channel list: the first one is global, that's applied to all objects of my class ...
user avatar
0 votes
0 answers
40 views

Web Scraping: finding a particular content and taking an action for multipule pages

Summary: the whole code is given at the bottom the problem (or say main concern) is described hereinbelow. The code scrappes the website goes through various pages and finds particular content to ...
user avatar
  • 231
3 votes
0 answers
47 views

Decorator implementation around xarray.open_dataset

If you would like to download some grib data for yourself, the script below will pull girb data from the google api over a date range at an hourly interval. Extract some hrrr grib2 data ...
user avatar
4 votes
1 answer
103 views

Check how many days a country has been independent

I have been using a website called 'CSNewbies' to learn Python and one of the tasks was to create a way for a user to check how many days a country has been independent. The countries are limited to ...
user avatar
2 votes
1 answer
100 views

Small shopping cart application - Solid Principles and Clean Code

I've recently had a technical interview where I had to identify code smells and refactor an existing code by applying the SOLID principles and implementing unit tests. It is a small shopping cart ...
user avatar
-1 votes
1 answer
54 views

Forecast experimental results based on temperature [closed]

I would really welcome any hints on making this code more concise please. In this example we have some experiment results. For each planned experiment We have predicted results based on 4 temperatures ...
user avatar
  • 3
-3 votes
0 answers
30 views

Whats the best way to pass many cli arguments between multiple functions in python? [closed]

I write a lot of cli tools in python. Most of my tools have something like this to get arguments: ...
user avatar
1 vote
2 answers
70 views

Comma code project from "Automate the Boring Stuff with Python"

...
user avatar
2 votes
1 answer
57 views

Credit Card Validation Check (Using Luhn's Algorithm)

...
user avatar
  • 333
1 vote
3 answers
50 views

Removing medications older than 180 days ago from a list

I have the following code which removes a dict from a list of dicts in Python based on ...
user avatar
  • 360
0 votes
2 answers
45 views

Speeding up row insertion to Pandas DataFrames [closed]

I have the below code that seems to be taking a while to run over time. ...
user avatar
  • 27
2 votes
2 answers
192 views

Multi stage Dockerfile for eccode compilation

I wrote a Dockerfile to install ecCodes for use in a python environment using cfgrib and xarray. The tarball can be found on the ecCode releases page Dockerfile <...
user avatar
15 votes
3 answers
3k views

My 1 Week Python Journey — A Quiz Game that I made in Python

I started my Python Journey almost a week ago from now. I had been following a Youtube tutorial earlier, but switched to Harvard's CS50P instead. I decided on making a little Quiz Game with my ...
user avatar
  • 333
2 votes
1 answer
42 views

Get some cryptocurrency rates from coingecko api

I'm currently learning some aspects of PEP8 and Python programming in general. Could you please code-review this little piece of code for me? I would be glad to hear any, even the smallest comments, ...
user avatar
  • 23
6 votes
4 answers
891 views

Guessing the Number Game

I started my python journey 4 days ago. I am following a Youtube tutorial currently to understand the basics of Python. So bear in mind that I am REALLY new to this. I wanted to test myself a little ...
user avatar
  • 333
0 votes
2 answers
63 views

12 hour to 24 hour time conversion

doing hackerrank challenges and been learning python3 for a month now, made this code to convert and return 12 hour to 24 hour time format in one of the challenges ...
user avatar
1 vote
0 answers
40 views

Python fractal tree generators

I wrote the scripts several days ago, they do exactly what I intended, but the performance is not very good, I am still stuck on for loops and don't know how to vectorize things, I wrote both scripts ...
user avatar
1 vote
1 answer
53 views

Program for creating custom directory listings

The following code was written to create custom directory listings for the Abyss Web Server. It attempts to provide an improved example of the included documentation for doing so in Python. However, ...
user avatar
2 votes
1 answer
44 views

Simple backup script with file removal after 7 days

Here is the script that I would like reviewed for the following: Best practices and design pattern usage Correctness in unanticipated cases Possible error checking Any streamline updates/ideas are ...
user avatar
2 votes
1 answer
50 views

Design Tic Tac Toe Interview Problem [Python 3]

Practicing objected oriented design. This time, it's designing the TicTacToe game. One difference between the real TicTacToe game is that I've made my TicTacToe game to have variable sized board. ...
user avatar
  • 155
6 votes
1 answer
407 views

Determine a diver's table and schedule based on depth and duration

I'm new to coding but I'm particularly new to python. I wrote a program that will determine a diver's table and schedule(because it relates to my job). It essentially assigns a value from multiple ...
user avatar
3 votes
1 answer
272 views

Design Shopping Cart System Interview Problem [Python 3]

Just practicing some objected oriented design questions. Please let me know what can be improved to be more OOD and extensible. Thank you. Functional Requirements Cart can hold multiple products A ...
user avatar
  • 155
6 votes
1 answer
100 views

Implementation and Testing of Exponential Search for scenario where we search the same array/list many times

Exponential Search is an optimization over binary search. Conceptually, when searching for a number target in a list of numbers ...
user avatar
  • 328
1 vote
1 answer
57 views

Adding string to a text file without duplicates

I have a function below, store_in_matchid_file, and it adds certain strings to a .txt file as long as that string doesn't already exist in the file. However that ...
user avatar
  • 27
12 votes
6 answers
2k views

One of my first Python projects - an adventure game

This is a simple text-based adventure game I made. I'm a beginner and I want to know if the code is optimal or if it can be improved. The story is not very complex, but I made it more for practicing ...
user avatar
5 votes
1 answer
191 views

Calculate the number of people occupied at each time interval

The following scripts calculate a list with the number of people occupied at each time interval. The intervals are defined by the timestamps of two consecutive events that come from the sorted list <...
user avatar
  • 53
0 votes
0 answers
27 views

Two Factor Authentication for safe storage with totp

This code snippet shows an implementation of two factor authentication. - It uses the library otp - It generates and verifies a totp - It creates a provisioning uri for the user Initial setup: ...
user avatar
0 votes
1 answer
48 views

Password policy with regex and zxcvbn

This code snippet shows an implementation of a password policy check. - The method composition uses regex to verify that the password meets composition criteria (at least one number, one special ...
user avatar
-2 votes
0 answers
47 views

Password hashing for safe storage with Pbkdf2

This code snippet implements password hashing for safe storage. It uses Pbkdf2 for the hashing algorithm. The method hash_password() is used to hash and salt a password. The method verify() is used to ...
user avatar
0 votes
1 answer
56 views

Calculates delivery charges and number of deliveries

Function: Calculates delivery charges based on area and also shows number of deliveries (fast food shop). Created to stop bickering from drivers and for stats. code: ...
user avatar
  • 191
1 vote
0 answers
56 views

Password hashing for safe storage with Bcrypt

This code snippet implements password hashing for safe storage. It uses Bcrypt for the hashing algorithm. The method hash_password() is used to hash and salt a ...
user avatar
8 votes
2 answers
1k views

Measure the total runtime of a function in a project

I recently wanted to find out which functions take which amount of time in a project, and calling a timer and printing the difference inside a function that is called multiple times does not scale ...
user avatar
  • 651
2 votes
1 answer
60 views

Password hashing for safe storage with Argon

This code snippet implements password hashing for safe storage. It uses Argon2 as hashing algorithm. The method hash_password() is used to hash and salt a password. ...
user avatar
0 votes
0 answers
44 views

Python image triangular mosaic creator

This is a Python script that turns images into "low-poly" art/creates a triangular mosaic from the image, I wrote this script completely by myself. In short, it takes a filepath to an image, ...
user avatar
3 votes
1 answer
87 views

Noughts and Crosses Python3

I'm trying to get more coding experience and decided to start small with a basic noughts & crosses game. Any feedback is welcome and below are the items I think I should add a print out of an ...
user avatar
  • 43
5 votes
0 answers
56 views

A Python script that creates n-flakes

I have written a simple Python script that generates n-flakes using matplotlib. Wikipedia article on N-flake. I wrote two functions, one function generates pentaflake, the other generates hexaflake, I ...
user avatar
2 votes
2 answers
84 views

3 dimensional python battleship game

I have an assignment in a python course. We were instructed to make a 3D Battleships game for 2 players on the same computer. I've written a code that works, according to the assignment instructions, ...
user avatar
11 votes
2 answers
3k views

Python script that pulls in and display a random xkcd comic

This script is supposed to download query xkcd json interface, find the total number of comics till date, pick a random number in that range, use the xkcd json interface again to find the comic image ...
user avatar
8 votes
2 answers
89 views

Frozen yogurt shop simulator

I made this project that simulates a frozen yogurt shop, where you can pick your flavor, toppings, and sauces and then pay for it. I'm a beginner at python and this is my first project. I don't even ...
user avatar
  • 81
4 votes
1 answer
59 views

Python blackjack code

Code below, very new to python, would love some constructive criticism, mainly in relation to what I could have improved on, if my use of aces (where I subtract 10) is smart, and my use of functions? ...
user avatar
  • 41
6 votes
1 answer
94 views

Python battleship game - Code to place random ships on the board

I am writing code to randomly place ships on a board in Python. I need help reducing the amount of Global variables I have in this code. I have thought about using a Ship class here but I'm not very ...
user avatar
0 votes
1 answer
69 views

Largest product in a series

Problem description: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 ...
user avatar
2 votes
3 answers
1k views

the 10001st prime number

Problem description: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? Prime number: A prime number is a whole ...
user avatar
3 votes
0 answers
43 views

Blackjack Python Code Feedback

Been working with python for a couple years on the side, looking to get feedback on this Blackjack game I made for some OOP practice. Code executes as expected (and I know the game is incomplete - no ...
user avatar
0 votes
2 answers
101 views

Sum square difference

Problem description: The sum of the squares of the first ten natural numbers is, 1² + 2² + … + 10² = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + … + 10)² = 55² = 3025 Hence ...
user avatar
1 vote
0 answers
62 views

A collection of Python functions that fill a given region with rectangles

These are what I was working on in the last few days, I wrote a bunch of functions that fill a given region with rectangles of different colors. The functions can: Randomly split a region into sub ...
user avatar
2 votes
1 answer
80 views

Python smart Hangman game

I made a smart Hangman game in Python and now want your opinion about the readability and code quality of this script. I want to improve my overall coding style. So I am happy to hear improvements for ...
user avatar
  • 123
2 votes
1 answer
523 views

The smallest positive number that is evenly divisible by all of the numbers from 1 to 20

Problem description: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of ...
user avatar
3 votes
3 answers
125 views

The largest palindrome made from the product of two 3-digit numbers

Problem description: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the ...
user avatar

1
2 3 4 5
102