r/Python • • Jun 10 '20

I Made This Currency converter - my first web scraping project :)

Post image
2.0k Upvotes

r/Python • • Nov 17 '19

This is one of the most interesting outputs of the particle simulation :)

2.0k Upvotes

r/Python • • May 09 '20

I Made This AI basketball analysis web App and API

2.0k Upvotes

r/Python • • Oct 27 '23

Tutorial You should know these f-string tricks

2.0k Upvotes

F-strings are faster than the other string formatting methods and are easier to read and use. Here are some tricks you may not have known.

1. Number formatting :

You can do various formatting with numbers.

>>> number = 150

>>> # decimal places to n -> .nf
>>> print(f"number: {number:.2f}")
number: 150.00

>>> # hex conversion
>>> print(f"hex: {number:#0x}")
hex: 0x96

>>> # binary conversion
>>> print(f"binary: {number:b}")
binary: 10010110

>>> # octal conversion
>>> print(f"octal: {number:o}")
octal: 226

>>> # scientific notation
>>> print(f"scientific: {number:e}")
scientific: 1.500000e+02

>>> # total number of characters
>>> print(f"Number: {number:09}")
Number: 000000150

>>> ratio = 1 / 2
>>> # percentage with 2 decimal places
>>> print(f"percentage = {ratio:.2%}")
percentage = 50.00%

2. Stop writing print(f”var = {var}”)

This is the debug feature with f-strings. This is known as self-documenting expression released in Python 3.8 .

>>> a, b = 5, 15
>>> print(f"a = {a}") # Doing this ?
a = 5
>>> # Do this instead.
>>> print(f"{a = }")
a = 5
>>> # Arithmatic operations
>>> print(f"{a + b = }")
a + b = 20
>>> # with formatting
>>> print(f"{a + b = :.2f}")
a + b = 20.00

3. Date formatting

You can do strftime() formattings from f-string.

>>> import datetime

>>> today = datetime.datetime.now()
>>> print(f"datetime : {today}")
datetime : 2023-10-27 11:05:40.282314

>>> print(f"date time: {today:%m/%d/%Y %H:%M:%S}")
date time: 10/27/2023 11:05:40

>>> print(f"date: {today:%m/%d/%Y}")
date: 10/27/2023

>>> print(f"time: {today:%H:%M:%S %p}")
time: 11:05:40 AM

Check more formatting options.

Part 2 - https://www.reddit.com/r/Python/s/Tzx7QQwa7A

Thank you for reading!

Comment down other tricks you know.

r/Python • • Jul 26 '19

Double Pendulum made with Processing.py

Thumbnail
gfycat.com
2.0k Upvotes

r/Python • • Nov 09 '19

My First Algorithm in Python! A Recursive Maze Solver

2.0k Upvotes

r/Python • • Mar 27 '18

Instagram in Terminal

2.0k Upvotes

r/Python • • Jan 05 '18

Really??

Post image
2.0k Upvotes

r/Python • • May 15 '20

I Made This This morning I decided to learn how to code in Python and after watching a YouTube course on the basics of the language, I coded this all by myself. It took me like 4 or 5 hours. I feel ashamed and super proud at the same time.

Post image
2.0k Upvotes

r/Python • • May 27 '20

I Made This Circle Evolution v0.1 is now available on PyPI. My first big project as a 16 year old. [Github repo & desc in comments]

Post image
2.0k Upvotes

r/Python • • Nov 12 '19

6 Months of learning Python, 3 Hours of Rendering, here is my first Mandelbrot Zoom

2.0k Upvotes

r/Python • • Jul 16 '20

I Made This Learning python so my wife customized my tumbler.

Post image
2.0k Upvotes

r/Python • • Apr 09 '20

I Made This Dijkstra's algorithm now running in linear time on a 90x90 grid

2.0k Upvotes

r/Python • • May 18 '21

Daily Thread Tuesday Daily Thread: Advanced questions

1.9k Upvotes

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.


r/Python • • Dec 14 '19

I created a maze generator, then solved it with Djikstra's algorithm

Post image
1.9k Upvotes

r/Python • • Jun 18 '20

I Made This I made the rotating circle *illusion* from numberphile's lates video

1.9k Upvotes

r/Python • • Sep 28 '18

I'm really bored at work

Post image
1.9k Upvotes

r/Python • • Mar 18 '20

Scientific Computing Fluid simulation in Python

1.9k Upvotes

r/Python • • Dec 14 '21

Resource Python Logo Candy

Post image
1.9k Upvotes

r/Python • • Oct 06 '20

Intermediate Showcase I made a program that gives me INFINITE STORAGE!

1.9k Upvotes

So, like the title says, I made a program using python that gives me infinite storage. More specifically it takes advantage of YouTube's infinite upload limit to use YouTube as a 100% free and unlimited cloud storage solution.

Demo video: https://youtu.be/yu_ZIr0q5rU

Source code (definitely still needs more work): https://github.com/AlfredoSequeida/fvid/


r/Python • • May 08 '20

I Made This My first Python program! Changes my desktop background based on the weather, time, and day.

Post image
1.9k Upvotes

r/Python • • Jan 29 '21

Beginner Showcase This post has:

1.9k Upvotes

(Offline)

Hello! I made a little Program which gets statistics about this post! It should be update every 20 seconds.

This post has 2109 Upvotes!

It has 234 Downvotes

and 299 comments!

The 3 top comments are from:

  1. u/BimphyRedixler

    |_Upvotes: 450

    |_First word: I

    |_Last word: account

    |_Letters: 41

  2. u/[deleted]

    |_Upvotes: 59

    |_First word: [removed]

    |_Last word: [removed]

    |_Letters: 9

  3. u/CaminoFr

    |_Upvotes: 105

    |_First word: ",

    |_Last word: None

    |_Letters: 7

  4. u/[deleted]

    |_Upvotes: 131

    |_First word: EditingThisToSeeIfICangeTheFirstWordSetting.

    |_Last word: AlsoChangingThisLOL!πŸ˜‚

    |_Letters: 86

  5. u/InveitableCactus

    |_Upvotes: 29

    |_First word: "

    |_Last word: "

    |_Letters: 32

Note: Sometimes theres a Person with lesser upvotes on place 1, If people are disliking comments, the reddit api does weird things!

Second note: The Up/Downvotes and comments are NOT accurate!

Last update: 2021-02-06 20:11:24 CET

total updates: 21319

Latest comment by: u/_elbob

First word: testing

Last word: code

Letters: 16

Random Comment: Left to right unicode charecter

by: u/Valtsu0

This idea was inspired by u/Krukerfluk Krukerfluk's post: https://www.reddit.com/r/Python/comments/hoolsm/this_post_has/

My code on Github: https://github.com/Jonathan357611/Reddit-comment-statistics

This program is hosted on a Raspberry pi zero!


r/Python • • May 30 '19

Dear python2 user

Post image
1.9k Upvotes