[VicPiMakers Projects] Jims challenge in google sheets + a bit of javascript in google apps

Michelle Wiboltt michellewiboltt at outlook.com
Tue Oct 20 10:23:33 EDT 2020


Couldn’t it be interpreted in a myriad of ways and not just with the repeaters? I mean, in this scenario isn’t it deterministic as to total output? Where’s the choice? Why not every 2nd then every 5th repeater be counted or some such thing?

Here’s what I’m thinking...I’m going to the mall (input) once at the mall the output determines that I will visit 5 departments in the mall (as illustrated in example above) but wait...I may visit 3 or 6 or 1 so, it’s determining an untrue/not necessarily accurate effect/causal relations, right?

Does this make sense?
m

________________________________
From: Projects <projects-bounces at vicpimakers.ca> on behalf of Greg H <greg.horie at gmail.com>
Sent: Tuesday, October 20, 2020 5:52:08 AM
To: Talk about Raspberry Pi / embeded projects <projects at vicpimakers.ca>
Subject: Re: [VicPiMakers Projects] Jims challenge in google sheets + a bit of javascript in google apps


> Test Input: 72,111,63,85,61,56,118,121,61,69,63,61

> Output #5: 5,61,61,61,63,63, (#repeats, list)

Here's how I interpret this. Given a list of integers, find all the values that repeat. Total the number of repeat values. This total is the first field in the output. Then sort the repeat values and join them as a comma-delimited list to the output.

In the example we find that 61 repeats 3 times and 63 repeats 2 times. 3 + 2 = 5.

Output Format:  <total>,<comma-delimited list of sorted repeats>
Hence:  5,61,61,61,63,63

Note - The last comma in the example output is distracting, so I removed it.







On Tue, 20 Oct 2020 at 00:40, George Bowden <gtbowdeng at gmail.com<mailto:gtbowdeng at gmail.com>> wrote:
Here is my answer<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1OFoQq69r5HlJ1udis0htAQqiEsLxvUcoZu9iSEuAeH0%2Fedit%3Fusp%3Dsharing&data=04%7C01%7C%7Ccbb7668e00df431caaed08d874f71652%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637387951857867520%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=o8AW6%2BtWE%2FXrdTb8j3V9d7L7Lkng3R8Frb2lFVp6o8c%3D&reserved=0> to Jims challenge in google sheets + a bit of javascript in google apps
I spent days seeing how to do this in forth language, but gave in to my weaker self...

My inputs are limited to 26 numbers.  Well, everyone has their limits <grin>.
Here is the javascript for #9.

function myF(str) {
  var returnStr="";
  for (let i = 0; i < str.length; i++) {
     var c = str[i];
     if((c >= 'A') && (c <= 'Z')) {           // Concatenate the next char only if it's a capital letter.
       returnStr=returnStr+c;
     }
  }
  return returnStr;
}

I couldnt understand question 5.

--
George Bowden,
gtbowdeng at gmail.com<mailto:gtbowdeng at gmail.com>
--
Projects mailing list
Projects at vicpimakers.ca<mailto:Projects at vicpimakers.ca>
http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvicpimakers.ca%2Fmailman%2Flistinfo%2Fprojects_vicpimakers.ca&data=04%7C01%7C%7Ccbb7668e00df431caaed08d874f71652%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637387951857877517%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fbMDLGRR5INfL2p7h1yzUPbQNm%2BOjkXyKEWbN%2FwaqAg%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201020/46370d88/attachment.htm>


More information about the Projects mailing list