Aug-18-2022, 04:42 PM
(This post was last modified: Aug-18-2022, 04:42 PM by rob101.
Edit Reason: typo
)
(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
>>> 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