Keen Learner and Exp... • 1d
Day 30 of learning python as a beginner. Topic: making a fully functional calculator. Yesterday I got introduced to tkinter and was successful in creating a basic graphical layout for the calculator and today I added logic into it and now I finally have my own fully functional calculator (though basic one). However I do want to emphasize that I don't really think I have learned tkinter as I required much of AI assistance here and I am not much confident so I may also practice more of this and maybe next I will learn about scikit-learn or TensorFlow (suggestions are welcomed). As you may know that I had created a basic calculator program in my first few days of learning python as a beginner and I just reused its functions in my GUI logic and I know I may have also used the library also however I just want to reuse my code (my excuse for practicing import functions). I used command function to add logic to each button, I first created an anonymous function using lambda which assigns the value of text to each button via a for loop. After this I created the logic of identifying and actually calculating the user's input and returning him a meaningful answer. For this I used match case (I can also use if else statements however I find match case more readable and scalable for future). I then used some common functions like .delete, .insert for deleting and inserting inputs to print the result. I then used regrex functions to replace input%input (eg 20%80) to (input/100)*input (eg (20/100)*80). Then I used try except for handling any possible errors which may occur while the user is using the calculator. And here's my code and it's result.
Data Enthusiast • 7d
hii actually I have my ai application. and I used gemini for the ai model. as am scaling my application I had to use gemini more. so what I did was I created multiple projects and in each project i created a single key such that the limits are only
See MoreKeen Learner and Exp... • 29d
Day 3 of learning python as a beginner. Topic: Loops Loops are of two types: for loop and while loop. For loop is used when: 1. you know how many times you have to repeat, in my case I know I have to repeat it 10 times to get a full multiplication
See MoreDownload the medial app to read full posts, comements and news.