Greetings Steemit friends
Installation of the working environment including Thonny and Qt5 Designer.
So far, the order is not a problem. You can start with any, but take note you need both applications installed to complete the project. I start to get to the official website but clicking the link Qt Designer Download You have two options and you pick with respect to your OS(operating system).
After the download is complete, in most cases. you will find the downloaded setup in the download folder. Start the installation by double-clicking the setup.
Click Next, you have the option to choose where you want your installation files to be saved by clicking Browser. In most cases, and for me. I will not make changes, and continue with my installation.
Installation will take some minutes, and you will be notified when all is done. We can click finish and launch our application to make sure no installation file is missing along the line.
Thonny
Steps are not different, we start downloading our setup from the official website Thonny Website. Here the latest version is visible, with a different operating system. By moving your cursor over your OS, you have the option to download.
After the download is complete, in most cases. Move to the download folder and start installation by double click the setup.
You can continue by clicking next, not forgetting to check to accept to agreement. Most of the time it is advisable to read. let's continue by clicking the next.
click Browser if case you want to change the location of your installation files, or you want to change your project folder. let's continue by clicking the next.
All done, and our installation is completed.
Let's run the Thronny application and install the necessary packages for the project.
Tools then select Manage Packages
Type PyQt5 in the search bar for easy search
Click on Install, and wait for a while.
Back to tools, then select Manage Packages. This time type pyqt5-tools in the search bar for an easy search.
Click on Install, and wait for a while. Finally, we are good.
Task2: (3points)
Here we are to get the natural number which is great 1 and can't be gotten by multiplying two natural numbers. That is 1 and itself.
So, I will start with a function to check if the number is a prime number. The number must be greater than or equal to 2. Next, we check the number greater than 3, if we result in having a factor. Then the function will have to return false. Note that 2 is the only even prime.
Next, the function is to carry out the operations for the two numbers. I passed the two parameters a and b. I will use a for loop to check the numbers within the range a b and check if it is a prime number.
The next function is to make use of the UI, which I designed using Qt. the two input fields for a and b, make sure they are integers.
I did my first check, might not be necessary but recommended. This is to make sure both inputs are greater than 2. Next, I created a variable message to hold the function to get the prime numbers of the two inputs (a,b).
It values, if true, an array of numbers. One more thing, the checkbox we have on the user interfaces. If it checks, sort the message in descending order.
We have the RESET function, which we have in the course and the QUIT function.
Task3: (3points)
To have prime factorization, we will break the number into prime factors. I will start by creating a function to handle the logic. First, check if the number input is greater than or equal to 1. I set the variable factors to the array. I used the while loop to check if the range of the input value is divisible by 2. Next, after number 2, we have 3. Time to check odd numbers by dividing until the result is stocked.
Finally, the output of both the while and for loop is greater than 2. Then we have a list of factors of the inputted value (num)
Nex function makes use of the function above and ui completes the project. Here, prime^count comes into play to help in formatting the output. I hope from my explanation of a prime number, we understand why we have 1 after each prime.
Task4: (3points)
This task is a mathematical project and will need a formula.
n!
C(n,p) = --------------------------
p! x (n-p)!
Not to crack my brain, I noticed I could make use of the math package.
Create the function to get the combination making use of the math.factorial function to ease the combination.
The next function is not different from the previous two projects. Here, I have updated values for n and p variables. A check to make sure (n <= 0 or p <= 0 or n < p) before going ahead to execute the function to get the combinations displayed.
You have an interesting blog. Very good work. Everything is very clear.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Upvoted! Thank you for supporting witness @jswit.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit