Python Forum
[split] simple calculator
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] simple calculator
#4
(Aug-18-2022, 04:07 PM)FelixLarry Wrote: Hello rob101,

You have made a great deal of comments on this code of mine and I appreciate it. I have already been knocking my head around on other ways to improve the code as you have technically advised. However, since I am totally new to Python, and this happens to be my first programming project, kindly help me input all the technical points you are raising, even though I have made some attempts to do that from my end but as an amateur, it's not been easy at all. Your help will give me a great deal of mileage in my journey.

Thank you.

You are very welcome.

The reason that I suggested the code line calculate = list(input(": ")) is because it can achieve two objectives in one: it can be used as a part of the user input sanitization function as well as for evaluating the input as a calculation. To do these operations, you'll need to understand how a list can be 'unpacked', which means accessing the individual elements. This is a fundamental operation that you will need to learn, as it can be applied to other objects, such as a string, or a tuple, two name just two good examples.

Have a go, using whatever learning resource you're already using and come back with just some basic code that can unpack that input example, or whatever failed attempt you come up with and we'll take it from there.

Note: I'm not in control of this thread, but my guess is that it will be moved to 'Homework', but it's only my guess.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Messages In This Thread
[split] simple calculator - by FelixLarry - Aug-18-2022, 02:24 PM
RE: [split] simple calculator - by rob101 - Aug-18-2022, 03:38 PM
RE: [split] simple calculator - by FelixLarry - Aug-18-2022, 04:07 PM
RE: [split] simple calculator - by rob101 - Aug-18-2022, 04:42 PM
RE: [split] simple calculator - by FelixLarry - Aug-19-2022, 12:41 AM
RE: [split] simple calculator - by menator01 - Aug-19-2022, 06:29 AM
RE: [split] simple calculator - by rob101 - Aug-19-2022, 10:07 AM
RE: [split] simple calculator - by FelixLarry - Aug-19-2022, 11:15 PM
RE: [split] simple calculator - by perfringo - Aug-19-2022, 10:46 AM
RE: [split] simple calculator - by FelixLarry - Aug-20-2022, 11:34 AM
RE: [split] simple calculator - by Yoriz - Aug-19-2022, 01:22 PM
RE: [split] simple calculator - by rob101 - Aug-20-2022, 12:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  a simple calculator Solstice 17 8,938 Mar-10-2019, 09:15 AM
Last Post: Ablazesphere

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020