Share your repls and programming experiences

← Back to all posts
Show this to your *nice* math teacher!
h
Whippingdot (658)

How this works

First you input the numerator and denominator of the fraction one by one. The program then calculates the HCF/GCD of the numerator and denominator and divides the numerator and denominator by that. The result is the simplified numerator and denominator. It is then outputted.

Note and Credits

This program was made with help from @RohilPatel so I hope you don't get angry cause of the title. It was also made with help from @maxyang and @fuzzyastrocat.

How I got the help

Basically in the post "Show this to your mean math teacher" I asked how to create a fraction simplifier cause I had been stuck for a loooooong time. I got an answer from @fuzzyastrocat, @RohilPatel, and @maxyang. They really helped me by giving ideas, and so I got to finish this calculator.

Another Note

I would make this prettier using HTML, CSS, and JavaScript but I am still in the process of learning HTML, CSS, and JavaScript. In another 3-4 months I will be done and I will try to make this more pretty. Also, can you even add python code in a HTML page?

I don't wanna ask you to upvote as it sounds like begging for cycles. But upvote if you liked this?

Comments
hotnewtop
Whippingdot (658)

@maxyang Thanks. 🤣🤣😁😁

BD103 (139)

Cool! You can use Python to host a website using Flask, but it is quite hard to do. :)

Whippingdot (658)

Oh, thanks for the tip. But then how do you create websites that do stuff. Can JS do the same things Python can? @BD103

BD103 (139)

Yes, basically. It's a bit harder to learn, but it has a lot more functionality than Python. I'll write a sample website to show you! ;D @Whippingdot

BD103 (139)

Go to https://repl.it/@BD103/Simplifier
Sorry if it's a bit confusing, I tried to add comments to explain what's happening. I ended up using PHP because you can create static links with it. I could possibly do JS, but that would mean rewriting it again! Have a good rest of your day, @Whippingdot
~ @BD103

Whippingdot (658)

Thanks for the help!!! @BD103

Whippingdot (658)

This soooo cool. Thanks. A LOT!!! Then if I want to do this, do you think I should learn PHP, or is it ok if I learn JS. Because I am already learning HTML, C++, CSS, JS, and I have finished Python so... Also Java. @BD103

Whippingdot (658)

Wait, @BD103. You are writing HTML, how is that PHP. This is sooo confusing. And instead of using <label> in index.php, why didn't you use <p>

BD103 (139)

You should learn HTML, CSS, and JS as a combo. They are all necessary for making websites. Next, you don't really need to learn C++ because Python has more support and libraries and is easier, but you can if you want. You don't need to learn PHP. I used PHP because then I could give you a link to a fraction solution. You can use JS to get the content of the text box and create a variable from that. I used the <label> tag because it was inside a <form> tag. I'm sure <p> would have worked too. :)
Last, do you want me to make a JS version of this? @Whippingdot

Whippingdot (658)

Ummmm....If you have the time you can make a JS version? I don't want to waste your time. And yes, I am learning HTML, CSS, and JS as a combo. Right now I am in HTML, and after that CSS. I am learning C++ cause I wanna do game dev in the future. C++ takes less run time then Python so it is more used for game dev. C++ and C# are the most popular in the game dev space. @BD103

Whippingdot (658)

And you didn't answer one of my qs, you were writing a HTML doc, so why was the extension PHP? Is that just how you code PHP? @BD103

BD103 (139)

Sorry for not answering your question. PHP is basically a plugin to HTML, you insert the PHP code into an HTML file, but make the extension .php so the webserver knows to run the specific code. You also have to keep in mind that if you use PHP to select the PHP Web Server language from repl.it. But I guess that's not the point. Check out w3schools' tutorial for more information, but if you don't plan on using it then that's fine! I'll make the JS version :) @Whippingdot

BD103 (139)

Here is the JS version
https://simplifier-php.bd103.repl.co/simplifier.html
I tried to label it all, hope it helps!
@Whippingdot

Whippingdot (658)

Thank you, @BD103. You are very helpful.

BD103 (139)

I try :)
See you around,
~ BD103
@Whippingdot