Skip to main content

Where Is It? Part 1 - Inputs

A woven reed basket, with a ginger kitten's ears showing through

Photo by Pixabay from Pexels
 
 I am job-searching, and running into some coding challenges. Most of them are simple - some seem to want one-line solutions that require two cups of coffee and a half-hour to figure out what they want. Others are far above where my skills lie, and these I give a try for, and learn.

And then there are the ones that offer, seemingly randomly, a challenge - within my skills (or at least my research skills) - that could be used as part of a larger project that I want to work on. This was the case last week, when I tried for a position that was a bit above what I felt I could do comfortably.

The challenge was to let someone enter items, and then give back their location. In a language I am just familiar enough to be a danger to myself in. Happily, and thinking forward about how I could use this as a part of a larger program that would  use something like this to interact with the user. And also, this is command line, and thinking of how to set this up to use a more-graphical interface.

Which means, as you may have guessed, that the program was not done in time to let me be considered for the job. It *still* isn't totally done - I just now solved a section that had me confounded.

This was taking two separate inputs - the item, and then its location (still working out how to insure that multiple items stored in the same location can be found), and adding them to a Python dictionary. Which has its own restrictions, but it's a good learning tool. If I figure this out, and need to change types later, I'll still have learned some valuable things.

Like how to get these inputs, typed separately, into the key:value pairs that are needed to add them to a dictionary.

Of course, the first thing I did was to set up limits on the input fields - so far, they are unique item name between 1 and 50 characters, and the same restrictions for the location (no naming everything "Shoes" and putting them in "closet"!), and adding a word to type in to stop the entry. So far, this worked - I was delighted! And without wanting to toss the computer through the nearest wall.

But, the next day, these guards got removed - I wanted to get the item name and location into a dictionary, and print out the items already listed. If I placed things in the dictionary, they would show nicely. So that part worked.

But, adding things to the dictionary was not going well - it needs the information in a form that it could accept. And the easiest thing was a dictionary. But making a dictionary to fill a dictionary? Why can't I just toss these two into the update, and be done with it?

After multiple error messages (I'm expecting 2 items you have given me 4, or 1) I finally resorted to looking at StackOverflow. This is something I try NOT to do - I prefer documentation and a bit of freedom to play. But there, on the first page of search results, was a simple one-line command to get the inputs separated, and then get them into pairs.

All right, I don't like it, but I can have the item and its location typed in at one time. Which is why the guards went away. And that didn't work. I missed something. So back to staring at the screen - which only makes me less likely to see the error.

It's a nice day - and someone else wants to go for a walk. This should help me figure this out, or at least stop me from trying the same thing multiple times, and getting upset because it doesn't work. And the breeze felt good - the sunshine even better, and feeling like it was too warm outside was a change.

So back to looking at the situation after a break - they are using two separate variables to get this in, so I *can* use my old style, and have them input the item and its location. So back the guards go!

Type the formula in - since it's simple, I don't need to copy it - and try. And, it doesn't work. It's getting late, and I have to cook tonight, so back over to the SO page, and copy the line.

And feel very silly - the syntax is {[ ]} (or square braces inside curly braces). And I'd forgotten the inner square braces. Try this, add some silly data, and it worked! I was able to see both the updated dictionary, and get back the item that I'd added to the dictionary.

So this worked - and now I can move on to the next part of the issue. These lessons are going to be valuable as I make larger projects.

I hope you think of sharing what you learn, so the rest of us can learn from your errors and successes!


Popular posts from this blog

30 Days of Postman - for Testers!

  https://www.pexels.com/photo/white-and-brown-cat-lying-beside-a-laptop-and-toys-5468268/ Photo by Karolina Grabowska from Pexels   Working with developer- focused tools can be a challenge for some testers: we may know what the words mean, but haven't used those skills recently enough to make the tasks simple. Or we may not have ever used them, other than at a quick glance to make sure that what we are getting matches what it should be sending. And some give results that require us to go find another team member to help interpret the results. Being a more-independent tester has always been one of my goals - being able to use the tools that are common in the team, and be able to do at least basic tasks that support my tests with them. Our team used Postman for many of the API tasks that we had, so exploring this tool was a natural fit. There are alternatives it there, both graphical and command line, so feel free to explore! The items that you can do, and tools that ...

Thanks Giving 2018

http://thriveology.com/wp-content/uploads/2017/11/ThankfulGrateful.jpg It is that season for we Americans: a time to look back at the past year, and count our blessings.  Thanksgiving has come to mean different things then while I was growing up - the focus is no longer on what has gone right, but what wrongs were (and, in some cases continue to be) done. I try and focus on what I can do to minimize the wrong, and accept that the past has happened. And then the fun begins - finding all the things to be thankful for! Things have been rocky, at points this year, I'm still unemployed for money, and have had some serious personal issues arise and be dealt with. But, all in all, I think the bad is outweighed by the good.  This has been a year of changes: not only have I given up on trying to go back to the way things used to be, I have moved forward - supported, encouraged, and occasionally pulled - into a future that I just now am starting to feel I deserve. I sti...