Python Tutorial: Calculate Number of Days, Weeks, or Months to Reach Specific Goals
Вставка
- Опубліковано 7 січ 2025
- In this Python Programming Tutorial, we will be writing three different scripts to estimate how long it will take to reach certain goals. Our first script will calculate how many months it will take us to pay off a credit card. Our second script will calculate how many weeks it will take to lose a certain amount of weight. And our third script will estimate how long it will take to reach a certain number of subscribers. Let's get started...
The code from this video can be found at:
github.com/Cor...
Python Datetime Tutorial: • Python Tutorial: Datet...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com...
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Python
Corey, I would like to thank you for your amazing work! Your videos are well explained and contain high-quality knowledge. Thanks to your tutorials I have changed my current job and from February I am starting working as a Junior Software Developer.
Keep it going!
Donation sent :)
Thank you Corey; I am happy I took the time and listened to your videos; I just want to thank you and I will continue to support you,
All the best!
Corey you kick ass at teaching and making good videos. Just last night I decided I wanted to get into coding. I've watched many videos that show basics of it- like how to write lines and what to put in the lines for each language. However, even though those are helpful to learn what to input, you're the first to clearly show what the output is. Very satisfying to see the code actually put to work and it really helps me to understand how to apply code to real application. Love your videos. You get right to the point and explain in a very clear and concise manner. Keep it up
Glad you're getting into coding! Hope you enjoy it. And I'm happy to hear you find the videos helpful!
Great Video, as always. Thanks a lot!
Just a minor issue though,
using the calculations in the video here, the annual interest rate would actually exceed 0.13 per year.
To convert an annual interest rate to an effective periodic rate (e.g. monthly rate), you don't divide by 12, instead take the 12th root.
In this case:
interest_charge = (((interest_rate + 1) ** (1/12)) - 1) * balance
Thanks again for making brilliant Python lessons!
Opened the video and liked instantly. You deserve it!
Andrey Shepeta same:)
This is my first time using an Import Code, now I get the whole point if using one.
Thank you Corey !!!
Just subscribed! Excited to follow your journey to 100k subscribers and beyond! 😊
Corey, Thanks for your amazing work! All videos are well explained with high-quality.
Just want to say i really appreciate what you're doing here.
thank you
Excellent video Corey! Clear explanations which make listening to your vids at 1.5x speed while driving achievable!
legend
If you need to perform more complex date manipulations, look at the dateutil module.
One notable feature is the handling of months:
# pip install python-dateutil
from dateutil.relativedelta import relativedelta
end_date = end_date + relativedelta(month=+1)
Hey man! I have gone through lot of python tutorials but you are the best i have encountered. Thank you so much for wonderful videos with such a great explanation. I have a request for you... Please post a video on calculating astronomical julian date from current date and calculating date from astronomical julian date. I saw some stuff online but no one explained in a better way. Hoping you would post video soon.
Cried when he said "that was a very interesting script" 14:46
Great python tutorial. Thank You.
This is why when I changed my DS date I could speed up daycare in pokemon.
Thanks a lot for your time spending for us in creating videos..If possible make videos on explaining about Pandas, Numpy, Scipy and Matplotlib libraries please
man i love the way you explain stuff can you please consider doing a tutorial about gui for python like pyqt or Kivy
woah, i was just doing this and i realized that i have the exact same date as he does except its 2019 XD
Hey thanks for the video! Is it possible to use datetime within a 5 day
week (business week) structure, as to avoid an output of the weekend
for example? Thanks
May i ask can you create a video that uses this kind of thing in a if and else python that calculate the day of numbers and a thing that accept date if its valid or not.
Is python a great choice for competative programming ? If yes then please cover data structure and algorithm in python also in your channel please. Specially dynamic programming.
Hey please make detailed videos on data structures and algorithms in python with their implementation
Hi Corey, I hope you are doing well, I just wanted to check with you, if you have any plan to make some tutorials on python django. Your style of teaching is extremely good.
Yes, I do plan on making Django and Flask tutorials. I am actually switching jobs at the moment so I am pretty busy finishing up work at my current job, but when I finish here at the end of February then I will be able to devote all of my time to finishing those videos.
Thank You Corey. Its so nice that you took time to reply. I am not sure, what you do for living. But if you are working somewhere as a full time employee and taking time out to make these videos, then you must be a super human.
Hoping to see your tutorials on django. So, that the world can benefit out of it.
How would you make the same programs work, but with a user input for your fixed numbers instead? I keep getting str errors.
Kinda late but if you're getting string errors it's because the input is a string and you can't use strings for math. Use int() to covert it to an integer. Ex: int(input("whatever you want the prompt to be:"))
from morocco thanks
Hey Corey ,when are you gonna start the Flask Series???
I have started putting together the material for it but it is taking longer to put together since there is more to cover. I try to put out smaller videos in between so I still have content coming out while I’m working on the larger projects.
Corey Schafer Thanks man 👍
hi i was wonmdering if you could help me i am trying to make a script that will display a message in 3 mounths time how would i do this this is all ihave (it is also a clock
import easygui
import sys
from tkinter import*
import time
from datetime import datetime
import calendar
run = True
easygui.msgbox("This is a clock made in python by Ben robinson", title="much cool")
def tick():
global tick
time_string = time.strftime("%H:%M:%S:%a:%d:%b")#gets the current time
clock.config(text=time_string)
clock.after(200,tick)#after 200 millisencons tick
while run == True:
root = Tk()
clock=Label(root,font=("Helvetica",50,"bold"),bg=("white"))#font colour and size of clock
clock.grid(row=2, column=2)#colum place ment
tick()
root.mainloop()
It is 2024, and you have now 1,27 milion subs, 😊 wish you double that much!!!
Waiting for you, I'm waiting for you, I'm waiting for you. Taken for Django :'(
My output is exposing the code although the results are correct for example
(datetime.date(2018, 3, 1), 4554.17)
(datetime.date(2018, 3, 26), 4103.51)
(datetime.date(2018, 4, 20), 3647.96)
(datetime.date(2018, 5, 15), 3187.48)
(datetime.date(2018, 6, 9), 2722.01)
(datetime.date(2018, 7, 4), 2251.5)
(datetime.date(2018, 7, 29), 1775.89)
(datetime.date(2018, 8, 23), 1295.13)
(datetime.date(2018, 9, 17), 809.16)
(datetime.date(2018, 10, 12), 317.93)
(datetime.date(2018, 11, 6), 0)
how do u add a input asking people what there balance, interest rate, and monthly payment is and then calculate it
A revolution without dancing is a revolution not worth having.
and now you got 1.23 m subscribers
Thank you Corey; I am happy I took the time and listened to your videos; I just want to thank you and I will continue to support you,
All the best!