Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,266 members, 8,002,096 topics. Date: Wednesday, 13 November 2024 at 11:35 PM

Contest[closed] : Program A Function to find if a phrase. is in a string - Programming (3) - Nairaland

Nairaland Forum / Science/Technology / Programming / Contest[closed] : Program A Function to find if a phrase. is in a string (4063 Views)

Php Function To Generate A Random Expression / User Defined Function To Validate Regular Expression In Javascript / I Can Program A Html Css Javascript Website For 1k (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: Contest[closed] : Program A Function to find if a phrase. is in a string by jidez007: 8:45pm On Aug 03, 2017
silento:



NICE WORK BUT return 1

when matched to "the aboyu is a man"

Well, the function is find() which returns either true or false, the main() is just to test.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 9:04pm On Aug 03, 2017
silento:



NICE WORK BUT return 1

when matched to "the aboyu is a man"

Isn't that wrong then correctness is a key in algorithm.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 10:04pm On Aug 03, 2017
jidez007:


Well, the function is find() which returns either true or false, the main() is just to test.

drop you number for your prize
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 10:18pm On Aug 03, 2017
CryptoCoinr:


Um, no it isn't. As orimion said above, your question was unclear and even the inbuilt functions of various languages, or JS at least, finds "words" whether they are fragments on solitary.

don't use failure as an excuse to try some thing New

if the question was unclear clear why did you waste your time to even trying to write I expected all of your code to have the bug and that's why I said newbies only because newbies don't think beyond what they saw in pdfs

your Are afraid to write code that's your problem not mine go to the first page and
I have posted the solution

in the world of programming every thing is a file which depends on another file

that what am trying to educate young devs here

JavaScript is a great language and there many libraries

have you asked yourself those people coding the libraries are they not human like you


yes they are but they spent more time than you do on your research and on you ide

next time if you don't understand a question a client or and interviewer gave you ask question

this way they will know you know what you are doing


let assume that this function you coded it for Facebook

bros do you know that Facebook will be a laughing stock because it will detect boy as Boyne
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by CryptoCoinr(f): 10:34pm On Aug 03, 2017
silento:


don't use failure as an excuse to try some thing New

Nope. This wasn't failure, this was you being unclear in your specifications.

if the question was unclear clear why did you waste your time to even trying to write I expected all of your code to have the bug and that's why I said newbies only because newbies don't think beyond what they saw in pdfs

So you were being disingenuous on purpose. Good to know.

your Are afraid to write code that's your problem not mine go to the first page and
I have posted the solution

Dude, I fixed within minutes of you making up that rule so, again, nope, it's not a matter of being afraid. It's time to stop with the assumptions.

in the world of programming every thing is a file which depends on another file

that what am trying to educate young devs here

JavaScript is a great language and there many libraries

have you asked yourself those people coding the libraries are they not human like you


yes they are but they spent more time than you do on your research and on you ide

Um, how is this relevant?

next time if you don't understand a question a client or and interviewer gave you ask question

this way they will know you know what you are doing


let assume that this function you coded it for Facebook

bros do you know that Facebook will be a laughing stock because it will detect boy as Boyne



Nope. You're not a Facebook job interviewer and I've been on freelance job boards, their specifications are clear, yours wasn't as noted by orimion. It would be nice if you refrain from comparing yourself with Facebook or other such establishments.

2 Likes

Re: Contest[closed] : Program A Function to find if a phrase. is in a string by CryptoCoinr(f): 10:43pm On Aug 03, 2017
And BTW, this isn't my first rodeo with such mini-challenges so this isn't me being naive.

I did the FizzBuzz challenge, reversing an array without inbuilt functions, ... and something similar to this one from the CPP forum years ago, took a while but I did them. More recently, I also did a CSS challenge on the SitePoint forums albeit for no prize. When I submitted my code, the OP told me it was good but then used my answer to notify everyone to a "gotcha" that existed much like yours. He didn't blame it on the people who submitted their answers, claim he was clear in the OP and it was just our noobishness that was to blame or claim we would be the laughing stock of Facebook had we submitted our code to them, he just explained it.

2 Likes

Re: Contest[closed] : Program A Function to find if a phrase. is in a string by jidez007: 10:51pm On Aug 03, 2017
silento:


drop you number for your prize
08096646699
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 12:23am On Aug 04, 2017
Interesting. . .
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 1:07am On Aug 04, 2017
CryptoCoinr:
And BTW, this isn't my first rodeo with such mini-challenges so this isn't me being naive.

I did the FizzBuzz challenge, reversing an array without inbuilt functions, ... and something similar to this one from the CPP forum years ago, took a while but I did them. More recently, I also did a CSS challenge on the SitePoint forums albeit for no prize. When I submitted my code, the OP told me it was good but then used my answer to notify everyone to a "gotcha" that existed much like yours. He didn't blame it on the people who submitted their answers, claim he was clear in the OP and it was just our noobishness that was to blame or claim we would be the laughing stock of Facebook had we submitted our code to them, he just explained it.


don't take it too personally

we are not here to brag

we are here to learn upon all the coding I have done

it is only bubble search algorithm than I can write without headache


nobody is perfect
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 1:08am On Aug 04, 2017
jidez007:

08096646699


seen tomorrow you will get it
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 3:40am On Aug 04, 2017
Weldone bro, sorry i have been too busy to really assist o, going dey tough here. Fixing bugs upandan.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by jidez007: 6:45am On Aug 04, 2017
pcguru1:


Isn't that wrong then correctness is a key in algorithm.
You can not even encourage someone small.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 7:44am On Aug 04, 2017
jidez007:

You can not even encourage someone small.

I work in a fintech company, a small mistake means someone's money getting missing and getting invitation from risk management , a small mistake in an airplane means accident am not perfect but in computer science correctness is a key factor in algorithm am not trying to attack you but if it doesn't work, we meant to encourage you to make it work correctly if you not , that mindset of at least it works half way would be carried into the real world. I've made mistakes when instead of debiting 100 it took 1000 imagine if the person wanted to do 10000 transaction do you know how much trouble I would have been in, it was caught earlier and I fixed it. That's why am raising that point.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 8:01am On Aug 04, 2017
jidez007:

You can not even encourage someone small.


hahaha
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by silento(m): 8:01am On Aug 04, 2017
dhtml18:
Weldone bro, sorry i have been too busy to really assist o, going dey tough here. Fixing bugs upandan.


ok sir
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by jidez007: 9:19am On Aug 04, 2017
pcguru1:


I work in a fintech company, a small mistake means someone's money getting missing and getting invitation from risk management , a small mistake in an airplane means accident am not perfect but in computer science correctness is a key factor in algorithm am not trying to attack you but if it doesn't work, we meant to encourage you to make it work correctly if you not , that mindset of at least it works half way would be carried into the real world. I've made mistakes when instead of debiting 100 it took 1000 imagine if the person wanted to do 10000 transaction do you know how much trouble I would have been in, it was caught earlier and I fixed it. That's why am raising that point.
This case is different, the quiz stated 1 or 0 to be the return type and I returned a boolean. How bad does that sound?

I may be a beginner in c++ but I don't think I'm a beginner in general programming. Unlike you I work with a lot of companies not for a company.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 12:37pm On Aug 04, 2017
jidez007:

This case is different, the quiz stated 1 or 0 to be the return type and I returned a boolean. How bad does that sound?

I may be a beginner in c++ but I don't think I'm a beginner in general programming. Unlike you I work with a lot of companies not for a company.

Oh am not arguing about that he said it matched a wrong string but if that's not the case then my apologies. I never said you were a beginner , nor did I question your capability I only replied on the premise that I thought it didn't search the word properly if it's just the case of return 1 against true then i don't think that's an issue per se. I work officially for one company but still work for other companies through that one company, and also companies outside my company (freelance) . Not sure what this part does though only mentioned it cuz you did. Am not attacking you oh you did a very good job considering you chose C++
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 12:39pm On Aug 04, 2017
silento:



NICE WORK BUT return 1

when matched to "the aboyu is a man"

@jidez007

A big apologies I re-read it again I actually interpreted this to mean matching a wrong sentence but I see its the 1 issue, a big apology once again.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by jidez007: 1:46pm On Aug 04, 2017
Oh I don't think anyone got the quiz. Everyone taught of matching strings instead of word.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by dontro(m): 2:05pm On Aug 04, 2017
Why all these long grammar (codes)? Or I didn't get the question?

Can't this short PHP function do the job?

function getWord($word, $text)
{
if (strpos($word, $text)) {
return 1;
}
return 0;
}
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by orimion(m): 2:30pm On Aug 04, 2017
dontro:
Why all these long grammar (codes)? Or I didn't get the question?
without using builtin functions
I dont blame you for not totally getting it though, the author confessed to making the question unclear
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by Nobody: 2:31pm On Aug 04, 2017
jidez007:
Oh I don't think anyone got the quiz. Everyone taught of matching strings instead of word.

I have one am writing but work what it does is to check the first occurrence and if the next occurrence is not the next letter it keeps till all the conditions are matched and it check the po's and length of the string so if the word is 4 and the sentence is 10 and you are the 7th possible of the sentence and the match hasnt been found it would stop. Sounds nice right ?
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by mustaphagreens(m): 4:04pm On Aug 04, 2017
jidez007:
Oh I don't think anyone got the quiz. Everyone taught of matching strings instead of word.

I don't agree with the last sentence. findString function (refer to the last image in my submission) does exactly as required. It searches for the word in the sentence, returns 1 or 0 depending on whether it is present or absent respectively. E.g findString("boy", "silento is my boy" ) or findString("boy","my boy silento is" ) or findString("boy","boy my silento is" ) will return 1 not withstanding the position of the word in the sentence or phrase. findString contains no inbuilt function, I do not think the object None of 'Nonetype' used in the while loop could be considered as a function, it is similar to the int, list, string, tuple or dictionary object that we know. Moreover, it is impossible to build a search function without exploiting the attributes of at least one of these objects which means incorporating it in the code. Lastly, if you're familiar with python, I would love you to read through my code, run it with as many test suites as reasonable to reveal bugs, glass box or black box test if you like based on the specification:
Parameter 1: word
Parameter 2: phrase or sentence. I'm cocksure findString will come out successful in all.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by CryptoCoinr(f): 6:10pm On Aug 04, 2017
jidez007:
Oh I don't think anyone got the quiz. Everyone taught of matching strings instead of word.

Read the topic, I'm sure you know the difference between "match a phrase" and "match a word" exclusively.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by CryptoCoinr(f): 6:14pm On Aug 04, 2017
silento:



don't take it too personally

we are not here to brag

we are here to learn upon all the coding I have done

it is only bubble search algorithm than I can write without headache


nobody is perfect

LOL. I wasn't bragging though. When I start churning out projects as awe-inspiring as Tubik Studio, and with relative ease, or replicate the realistic parts of the hacking presented in F&F 8 then I'll brag.
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by badthinds: 8:02pm On Aug 04, 2017
CryptoCoinr:


LOL. I wasn't bragging though. When I start churning out projects as awe-inspiring as Tubik Studio, and with relative ease, or replicate the realistic parts of the hacking presented in F&F 8 then I'll brag.
Are you the owner of tubic studio?
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by CryptoCoinr(f): 8:11pm On Aug 04, 2017
badthinds:
Are you the owner of tubic studio?

No, but I wish I was grin

1 Like

Re: Contest[closed] : Program A Function to find if a phrase. is in a string by badthinds: 9:50pm On Aug 04, 2017
CryptoCoinr:

No, but I wish I was grin
Lol. You funny die
Re: Contest[closed] : Program A Function to find if a phrase. is in a string by badthinds: 9:50pm On Aug 04, 2017
CryptoCoinr:

No, but I wish I was grin
Lol. You funny die

(1) (2) (3) (Reply)

How Do I Pay For Apps On Google Play Store / Programming Languages Inventors / User Interface Design For The Beginning Web Programmmer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 83
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.