![]() |
|
[Python] Basic Python Calculator. (MY FIRST PYTHON PROJECT THINGY...) - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Basic Python Calculator. (MY FIRST PYTHON PROJECT THINGY...) (/showthread.php?tid=4258220) |
Basic Python Calculator. (MY FIRST PYTHON PROJECT THINGY...) - ~OMC~ - May 30, 2014 I've been paying a guy to teach me Python.
In 3 hours we've covered a shitload and I just coded this by myself. (he helped me where I failed) I must say, he's a great teacher. Teacher: stonerdays Code: Code # Calculator test by Mr.Zetax / ~OMC~It works using ELIF's and userinputs. Enjoy. NO HATE PLEASE AS IT'S MY FIRST CODE. * - stonerdays - May 30, 2014 I taught OP Python basics in three hours. I know there a lot more easy/advance ways of making this, but it's pretty damn good for someone who started three hours ago. * - ~OMC~ - May 30, 2014 (May 30, 2014 08:33 PM)stonerdays Wrote: I taught OP Python basics in three hours. I know there a lot more easy/advance ways of making this, but it's pretty damn good for someone who started three hours ago.It's obvious why it's so good, right? I had an amazing teacher!:) * - R3X3Y - May 30, 2014 Good job OP... I just copied and pasted it into my Python IDE and it works great. I'm positive he's a great teacher but I think I'll stick to my free resources. Keep it up * - SIM-1866423 - May 30, 2014 Keep going bro you can do better 👍 * - M.o.n.s.t.e.r - May 31, 2014 Does that code have the same lines to much lines and im sleepy * - ~OMC~ - May 31, 2014 (May 31, 2014 01:41 AM)M.o.n.s.t.e.r Wrote: Does that code have the same lines to much lines and im sleepy Yeah, I C+P'd it as I couldn't figure out how to make Y answer loop back to beginning of the code.:( * - tideman2 - May 31, 2014 Why not instead of : Code if runagainq == 'Y':Code def Anything():So if the users said " if runagainq == 'Y':" putting "Anything()" will loop back to the top. Tip! You can do " Code if runagainq == 'Y' or == "y"Hope This Helps ! * - ѕнα∂σω - May 31, 2014 ARGH!!! Centered! BAD! Indenting is messed up. Never center your code. As for making it run a bunch of times you're going to need a while loop. Something like: Code runAgain = TrueThe loop will keep runnng unstil runAgain is set to False - that can only happen if runAgainQ is no. * - tideman2 - May 31, 2014 Code if runAgainQ.lower in ('y', 'yes'):Quote:ѕнα∂σω Also just to note by adding the .lower() the user input will be forced to lower helps with making your if and elif trigger True or False without having a cap error making it trigger your else Hope this helped, you might already know though * - #BORNE - May 31, 2014 Very basic dude but as you said this is your first code. My first code was also a calculator. * - clark.dll - May 31, 2014 Obviously there are more effective ways to code this out, but not bad for your first project. My first Python project was a calculator too. Keep it up. * - Jekwa - May 31, 2014 Not bad so far, but you should use a loop instead of copying the code several time. Overall you have done a good job. Keep it up and use loops. My first python project was a Calculator as well. As you learn more you can extend to it. |