teleren/devto huggingface dataset:
Python 27: Banking System (part 1)
Tags: python, beginners, daily, classes
Published: 2024-01-02 07:53:35

For todays Python exercises I wanted to do something with classes. I know the basics about them from CS50 Python, but haven’t used them since that, so it’s fair to say I am a total beginner. To practice this ChatGPT gave me a Banking System exercise (see next paragraph). Below that as always I share with you my code

**Exercise: Simple Banking System**
Create a basic banking system.
Allow users to create a new account, deposit money, withdraw money, and check their balance.
Use classes to represent users and accounts.

**My Code** 

Since I’m not very familiar with classes I was only able to do a first part of this exercise today. I decided to just make it work with one account. I’ll still need to implement the bank and more features in the coming days 🙂

```python
import logging

logging.basicConfig(level=logging.DEBUG)

class Account:
    def __init__(self, account_id, holder_name, initial_balance=0):
        self.account_id = account_id
        self.holder_name = holder_name
        self.balance = initial_balance

    def deposit(self, amount):
        if amount > 0:
            self.balance += amount
            logging.info(f"Deposited {amount}. New balance: {self.balance}")
        else:
            logging.warning("Invalid deposit amount.")

    def withdraw(self, amount):
        if 0 < amount <= self.balance:
            self.balance -= amount
            logging.info(f"Withdrew {amount}. New balance: {self.balance}")
        else:
            logging.warning("Invalid withdrawal amount or insufficient funds.")

    def get_balance(self):
        return self.balance

class Bank:
    ...

def main():
    account = Account(123, "John Doe", 50)  # Creating an account with initial balance 50
    try:
        while True:
            user_input = input('What would you like to do? Options: n = new account (currently not available), d = deposit money, w = withdraw money, c = check balance, e = exit\n')
            if user_input == 'n':
                logging.info('This feature is not yet avaiable. Please wait for an update in the coming days')
            elif user_input == 'd':
                amount = float(input('Enter deposit amount: '))
                account.deposit(amount)
            elif user_input == 'w':
                amount = float(input('Enter withdrawal amount: '))
                account.withdraw(amount)
            elif user_input == 'c':
                print(f"Current balance: {account.get_balance()}")
            elif user_input == 'e':
                break
            else:
                logging.info("Invalid option selected.")
    except KeyboardInterrupt:
        logging.error('KeyboardInterrupt')
    except ValueError:
        logging.error("Invalid input. Please enter a number.")
    
    logging.debug('main() end')

if __name__ == '__main__':
    main()
```
Simplified: Penulis Blog AI untuk Blog Makanan Organik
Published: 2024-01-02 07:53:15

Simplified adalah platform yang menyediakan penulis blog AI untuk **[blog makanan organik](https://simplified.com/ms-ai-blog-writer/organic-food-blogs)**. Dengan bantuan teknologi AI, anda dapat meningkatkan kualiti blog makanan organik anda dengan mudah.
Simplified membantu anda meningkatkan kualiti blog makanan organik dengan penulis AI. Dengan teknologi AI kami, anda dapat mencipta blog makanan organik yang berkualiti tinggi dan menarik.
Tingkatkan kualiti blog makanan organik anda dengan bantuan penulis AI dari Simplified. Dengan bantuan teknologi AI kami, anda dapat menulis blog makanan organik yang menarik hati pembaca.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57k7alexayn21fmzxqsd.jpg)

**[https://simplified.com/ms-ai-blog-writer/organic-food-blogs](https://simplified.com/ms-ai-blog-writer/organic-food-blogs)**
LeetCode Problem : Palindrome Number
Tags: math
Published: 2023-12-28 17:25:13

---
title: "LeetCode Problem : Palindrome Number"
published: true
description: "LeetCode Problem Analysis"
tags: math
series: "math and bit-manipulation problem"
---


### Problem Statement
>Given an integer `x`, return true if x is a
palindrome, and false otherwise.


### Intuition
> How to revert integer number? How to approach this problem without even converting into string? 




### Approach
> integer 121 for example, 

```shell
121 / 10 = 12
121 % 10 = 1 , let this be 'a' 

12 / 10 = 1
12 % 10 = 2 , let this be 'b' 

1 / 10 = 0
1 % 10 = 1 , let this be 'c'

reverted number is (((a*10) + b)10 + c)
```

>   But here we want to revert only half because the range of the given input number is between -2^31 and 2^31. That is 2147483648 and if we try to revert this number entirely, int type can not even hold this value since the least significant digit is greater than the most significant digit. Therefore what we want to do is to revert only half of it. We can do this by making sure building-reverted number is less than the original number repeatly being divided by 10. For example, consider integer 1234, there will be comparison 4 vs 123 than 12 vs 43 and this is the exact condition we want to stop.

>   When the length of input is odd, we can simply do comparison between building-reverted number divided by 10 is equal to the original 'getting-smaller' number.

>   Lastly we want to handle following edge cases.
    - Negative number -> always not palindrome
    - 0 -> always palindrome 
    - number multiple of 10 -> always not palindrome

### Time Complexity
- O(log10 N) : Every iteration we divide the number by 10 




### Code
``` go
func isPalindrome(x int) bool {
    var rev int
    if x < 0 || (x % 10 == 0 && x!= 0){
        return false
    }
    if x < 10 {
        return true
    }
    
    for x > rev {
        rev = rev*10 + (x%10)
        x = x/10
    }
    if x == rev || rev/10 == x {
        return true
    }
    return false
}
```


### Can We Do Better?
No, O(logN) is already good enough



### Seed For Interview
Revert half of the number and be careful about few edge cases.
🔥 Tools I Fell in Love with ❤️
Published: 2024-01-02 07:24:10

As a developer, I am always on the lookout for new tools that can make my work and life easier and more efficient. Recently, I discovered some fantastic tools that I would like to share with you. They cover a broad spectrum of areas, from web development to movie streaming apps, and they are all great to use.

## 1️⃣ https://movie-web.app/
If you are into watching movies and TV series, then this application is a pure gem. It lets you watch any movie that is available online on random streaming sites for free. No need to open those shady pirated content websites. Just search movie on [MovieWeb](https://movie-web.app/) and start streaming directly. It doesn't even require a sign in. 

The only catch is you will not get the latest movies and tv series on this but still, It's worth keeping in your bookmarks for binge watching something on your lazy weekends. Plus, this is open source 🙌


![MovieWebApp Homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5d8tumhnvrekc8p8qajm.png)


**Credits**: [#buildinpublic](https://twitter.com/search?q=%23buildinpublic) community on twitter !!

---

## 2️⃣ https://www.phind.com/
It's a tool similar to chatGPT and I use it pretty much every day during my work. No sign-up/sign-in is required to use this. 

Phind stands out due to its focus on developers and technical questions. It offers features such as the ability to customize searches and set them as defaults, making it easier for users to find the information they need without having to manually search each time. Additionally, it provides an "Explore" feature that uses AI to suggest related topics and a "Surprise Me" feature that randomly selects topics for users to explore


![Phind Homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42p0nnu2xczarh8889m0.png)



---

## 3️⃣ https://hoppscotch.io/

Hoppscotch is a lightweight, web-based API development suite. It's an open-source and free alternative to Postman. What I love the most about this is that It has a lot of keyboard shortcuts which comes very handy when using this.


![Hoppscotch homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcn0nwivl6h5t4l513sl.png)

---

## 4️⃣ https://daily.dev/
DailyDev is one of my favourite chrome extension. It is a platform designed specifically for developers to discover new tools, tricks, and connect with each other. It provides a personalized news feed, developer communities, and search functionality.

One unique aspect of Daily.dev is that it does not have a downvote button, aiming to foster a healthy and sustainable community by avoiding negativity.

![DailyDev New Tabs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3583bxij8j4qxqnoxmgm.png)


---


⬇ Comment below if you have used any of these tools and share your experiences. Also, Do let me know the tools you use the most.

Thanks for reading ❤
Your Trusted Partner in Online Healthcare
Tags: healthydebate, doctor, consultation, telehealth
Published: 2024-01-02 07:43:13




Experience a revolutionary approach to healthcare with Teldoc, your dedicated partner in telehealth services. Say goodbye to the traditional waiting rooms and hello to the future of medical consultations from the comfort of your own space.

Teldoc brings the expertise of qualified healthcare professionals directly to your fingertips. Our Telehealth Doctors are a team of skilled and compassionate physicians who provide virtual medical consultations, ensuring you receive the care you need, when you need it.
Thông Báo Sự Kiện Hợp Tác SM66==>TK88
Tags: webdev, beginners, react, tutorial
Published: 2024-01-02 07:41:24

Thông Báo Sự Kiện Hợp Tác SM66==>TK88
Để khẳng định sức mạnh mang ''Thương Hiệu Triệu Đô''
Bắt đầu từ hôm nay hệ thống SM66 được nâng cấp kết hợp trực tiếp với TK88.com
Ngoài ra tất cả Thông Tin và Số Dư của khách hàng không thay đổi-->"Đăng Nhập" trực tiếp trên TK88.com
Nhận 300.000VND chơi thử miến phí
Casino Hoàn Thua lên đến 28.888.888
Quà tặng bí mật lên đến 5 Tỷ cùng nhiều "Khuyến Mãi Dấp Dẫn" khác.
Web: http://tinyurl.com/codetrainghiem28k 
 #Tk88 #tk88com #sm66 #dangnhaptk88 #tk88123
Venue Hire Christchurch
Published: 2024-01-02 07:31:20

Venue Finder NZ, you can find a suitable location in Christchurch. Look through our extensive offerings for easy [venue hire in Christchurch](https://venuefinder.nz/category/event-venues/christchurch). Find the ideal location that suits your needs, whether it's for a social event, wedding, or corporate gathering. Our easy-to-use platform makes the search easier and provides a variety of solutions to fit every situation. Access a wide range of locations that are suited to your tastes, from small, cosy areas to large, elegant halls. Use our simple online booking system to quickly and easily reserve your perfect spot. With Venue Finder NZ, you can begin organising your next spectacular event Book now. Make your reservation online now to guarantee a flawless event in Christchurch.
Puravive (Exotic Rice Supplement) Puravive Reviews || Puravive Weight Loss Supplement 2024
Published: 2024-01-02 07:23:59

This started in a small organization in a rural area. I guess you'll like these keen bits of info. The area around my local Puravive Reviews store was patrolled by the police but also interesting moments are ahead it seems. Was that sensational or what? That is emotionally challenging. You probably won't understand these lovely ideas referring to that doodad that are a highly principled deduction from the universe . 

Why do freaks trip into this trap? This was according to the recent Institute for Puravive Reviews survey. The end result, of course, is to see a professional as that regards to this situation. I don't use it. I'm sorry, that was sort of half baked. The easy way to get ideas as that relates to this area of interest is to visit your local library or book store.

Although, like my buddy mentions often in connection with Puravive Reviews, "A good beginning makes a good ending." This place is a good place and I am finally happy with my Puravive Reviews. This is my analysis of the well oiled guesses this. I have been dealing with Puravive Reviews since last week.

Special Offer (CLICK HERE) ==> https://www.mid-day.com/lifestyle/infotainment/article/puravive-reviews-consumer-latest-controversy-and-warnings-puravive-weight-loss--23327502

https://gamma.app/public/Puravive-Reviews-9vj9t0vcbimufgr 
https://feedbackportal.microsoft.com/feedback/idea/27facd1d-32a9-ee11-92bd-6045bd7b0481 
https://www.eventogo.com/event/puravive-honest-warning-alert-exotic-pills-or-cheap-weight-loss-supplement-2024/ 
https://crypto.jobs/events/puravive-hidden-truth-exposed-what-every-user-must-know-before-buying-this 
https://medium.com/@rudybovenlee/puravive-reviews-weight-loss-supplement-does-it-work-you-wont-believe-this-72b288b5c508 
https://knownet.com/question/puravive-reviews-janurary-update-2024-does-puravive-really-work-for-weight-loss/ 
https://promosimple.com/ps/2a01f/rudyboven-lee 
https://rudyboven-lee.webflow.io/ 
https://www.scoop.it/topic/puravive-reviews-by-rudyboven-lee 
https://rudybovenlee.mypixieset.com/ 
https://cycloes-klaiarry-mccroord.yolasite.com/ 
https://rudybovenlee.weebly.com/
Introduction to the IDisposable Pattern
Tags: csharp
Published: 2024-01-02 07:12:46

The IDisposable pattern is an important concept in C#, especially when dealing with resources that need to be explicitly released or cleaned up. This pattern provides a mechanism to ensure proper resource management and prevent resource leaks.

In C#, any class that implements the IDisposable interface can take advantage of this pattern. The IDisposable interface contains a single method called Dispose, which is responsible for releasing the resources held by the object.

To implement the IDisposable pattern, a class needs to follow a few steps. First, it should implement the IDisposable interface and define a Dispose method to perform the necessary cleanup operations. It's good practice to also provide a finalizer in case the Dispose method is not explicitly called.

The Dispose method should release all the managed resources such as file handles, database connections, or network sockets. It can also release any unmanaged resources by calling native methods or disposing nested objects that implement IDisposable.

Once a class implements IDisposable, it is advisable to use the using statement when creating an instance of that class. The using statement ensures that the Dispose method is automatically called when the object goes out of scope, even if an exception occurs inside the using block.

By following the IDisposable pattern, you can ensure that resources are properly managed and released, preventing memory leaks and improving the overall performance and stability of your application. It is a best practice to always implement IDisposable for classes that hold scarce resources to maintain a clean and efficient codebase.
Create Stunning Anniversary Collages for Free with Our Online Collage Maker - Simplified
Tags: webdev, javascript, programming, beginners
Published: 2024-01-02 07:02:08

Celebrate your **[anniversary](https://simplified.com/ai-collage-maker/anniversary-collage)** with a stunning collage made for free using our online collage maker. Preserve your precious memories and cherish your love story. Get started now - Simplified.
website: [https://simplified.com/ai-collage-maker/anniversary-collage](https://simplified.com/ai-collage-maker/anniversary-collage)
JavaScript-ում Null-ի և Undefined-ի միջև եղած տարբերությունը
Published: 2024-01-02 07:00:52

JavaScript-ը, որպես բազմակողմանի և լայնորեն օգտագործվող ծրագրավորման լեզու, ունի որոշ առանձնահակություններ և նրբություններ: «null» և «undefaind» Երկու տերմին, որոնք հաճախ շփոթեցնում են ծրագրավորողներին, հատկապես նրանց, ովքեր նոր են տիրապետում լեզվին: Թեև երկուսն էլ ներկայացնում են արժեքի բացակայությունը, նրանք ունեն տարբեր իմաստներ և օգտագործման դեպքեր JavaScript-ում: Այս հոդվածում մենք կխորանանք null-ի և undefined-ի միջև եղած տարբերությունների մասին


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8oefkpium5xhhwutnnfq.jpg)

##Undefined:
JavaScript-ում փոփոխականին default վերագրվում է undefined երբ այն հայտարարվում է, բայց սկզբնական արժեք չունի: կամ երբ մուտք ենք գործում օբյեկտի գոյություն չունեցող property: Օրինակ:

```
let x;
console.log(x); // Outputs: undefined
```

Վերոնշյալ օրինակում փոփոխականը հայտարարված է, բայց արժեք չի նշվում, ինչի արդյունքում այն ​​ավտոմատ կերպով սահմանվում է undefined.


##Null:
Մյուս կողմից, null-ը արժեք է, որը պետք է հստակորեն նշանակվի: Այն հաճախ օգտագործվում է օբյեկտի արժեքի _միտումնավոր_ բացակայությունը ցույց տալու համար: Ի տարբերություն undefined-ի, որը default արժեք է փոփոխականների համար, null-ը ծրագրավորողի կողմից կանխամտածված ընտրություն է: Օրինակ:
```
let y = null;
console.log(y); // Outputs: null

```

Կարևոր տարբերություններից մեկy null-ի և undefined-ի այն է, թե ինչպես են նրանք վարվում համեմատության ժամանկա: null-ի տիպը օբյեկտ է, մինչդեռ undefined-ի տիպը հենց undefined է: Դրանք համեմատելիս դրանք արժեքով հավասար են, բայց ոչ տեսակով.
```
console.log(null == undefined); // Outputs: true
console.log(null === undefined); // Outputs: false
```
Առաջին համեմատությունը ( ==) ստուգում է արժեքների հավասարությունը, իսկ երկրորդը ( ===) ստուգում է և՛ արժեքը, և՛ տեսակը: Ընդհանուր առմամբ խորհուրդ է տրվում օգտագործել խիստ հավասարություն ( ===)՝ անսպասելի տիպի տարբերություններից խուսափելու համար:

Ամփոփելով, JavaScript-ում null-ի և undefined-ի միջև տարբերությունը հասկանալը կարևոր է մաքուր և առանց սխալների կոդ գրելու համար: Թեև երկուսն էլ ներկայացնում են արժեքի բացակայություն, undefined-ը սովորաբար default վիճակ է, որը ավտոմատ կերպով նշանակվում է լեզվի կողմից, մինչդեռ null-ը ծրագրավորողի կողմից արված  ընտրություն է:
Pod Systems Vs Disposable Vapes: Which One Suits Your Vaping Preferences?
Published: 2024-01-02 06:57:36

In recent years, disposable vapes have garnered significant popularity due to their simplicity, affordability, and effectiveness, particularly for those transitioning from traditional cigarettes to vaping. However, the landscape is evolving, and a new trend is emerging with the resurgence of pod systems, potentially making them the next big thing in vaping.

As a discerning business owner, the wide array of products to choose from can be overwhelming. However, the key differences between these two cannabis vaporizer options are commonly offered by manufacturers.

What are [Pod Systems](https://www.cannapresso.com/)?

Pod systems refer to vaping devices that utilize a pod or cartridge to contain the e-liquid. These pods can be refillable, although some devices come with pre-filled pods that are disposed of once empty. Pod systems are renowned for their user-friendly nature, making them an ideal choice for beginners.


What are [Disposable Vapes](https://www.cannapresso.com/)?

Disposable vapes are exactly as their name suggests – vaping devices designed for single-use before being discarded. These devices come pre-filled with e-liquid and a fully charged battery, providing unparalleled convenience.

Pod Systems Vs Disposable Vapes - A Comprehensive Comparison

Battery Life:
In terms of battery life, pod systems hold a slight advantage over disposable vapes. The ability to recharge pod systems allows for theoretically unlimited battery use, whereas disposable vapes must be discarded once the battery dies.

E-Liquid Capacity:
Both pod systems and disposable vapes have limited [e-liquid](https://www.cannapresso.com/hardwares/) capacity, but pod systems outperform disposable vapes here. The refillable pods in pod systems enable prolonged use of the same device, while disposable vapes are discarded once the e-liquid is depleted.

Customization:
For those who relish customization, pod systems are the preferred option. With pod systems, users can select their desired e-liquid and tailor the wattage and airflow to their liking. In contrast, disposable vapes are pre-filled and lack customization options.

Convenience:
When it comes to sheer convenience, disposable vapes take the lead. They are incredibly easy to use and require no maintenance or refilling. On the other hand, pod systems necessitate regular pod refills and battery recharges.

Vape Brand should offer multiple options

Providing both disposable and pod system vaporizers at the dispensary or vaping accessory store would cater to the diverse preferences of different individuals, resulting in a broader customer base.

For those busy individuals who prioritize convenience above all else, the ideal choice may be a disposable vape. Conversely, for those seeking a customized vaping experience and being open to minor maintenance, a pod system would be the more suitable option.
CONSULT BITCOIN RECOVERY EXPERT FROM - CODER CYBER SERVICES
Published: 2024-01-02 06:43:34

The world of cryptocurrencies presents both the terrifying prospect of losing everything and the exhilarating heights of possible rewards. A single missed key, a crafty hack, or the abrupt absence of a platform might cause your digital wealth to evaporate like smoke in the breeze. But before you give up on a life of ramen and regrets, introduce yourself to Adware Recovery Specialist—a group of digital investigators prepared to solve the mystery and save your cryptocurrency from certain death. In the crypto recovery game,  Adware Recovery Specialist  is more than just a name. Visit: adwarerecoveryspecialist.expert Their history, which is a tapestry filled with innumerable tales of clients finding their lost wealth again, speaks for itself. They've conquered everything, from lost private keys to pilfered Bitcoin, coming out on top of the maze-like world of dark web schemes and blockchain transactions. Adware Recovery Specialist is undoubtedly technically proficient, but they also recognize that cryptocurrency losses are more than just figures on a screen. They strike victims like emotional gut blows, leaving them feeling lost and powerless. Their strategy therefore goes beyond codes and algorithms. They provide constant support, a helping hand, and a sympathetic ear during the whole healing process. The Toolkit of the Adware: What, then, makes Adware Recovery Specialist the recommended team for misplaced cryptocurrency? Here is a look at their toolkit:  Using instruments akin to scalpels, they analyze transactions on the blockchain to find undiscovered paths and follow the whereabouts of your misplaced currency. Sometimes, thinking like a thief is the best approach to apprehend them. Strategic social engineering techniques are used by  Adware Recovery Specialist to entice and outwit the offenders. They use the newest technologies and strategies to keep one step ahead of the unscrupulous actors and remain at the forefront of the constantly changing crypto landscape. It can be a lonely and sad place to lose your cryptocurrency. However, you won't have to go it alone if Adware Recovery Specialist is at your side. They'll act as your virtual flashlight, shedding light on the steps to getting your lost money back and gaining your confidence back in the cryptocurrency space. Being without cryptocurrency can be a lonely and sad place. You don't have to walk it alone, though, if Adware Recovery Specialist is at your side. They will serve as your virtual lighthouse, shedding light on the steps of getting your lost money back and regaining your trust in the cryptocurrency community. 

Email: Adwarerecoveryspecialist@auctioneer. net

Regards.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7hp5c6wzd0vpu1m4uvc1.jpg)