I'm not a programmer but I've been watching some tutorials and can code some things in python that do various things...

I'm not a programmer but I've been watching some tutorials and can code some things in python that do various things like delete x amount of files in y directory. Or unzip this file until reached x amount then run some training code.

I never took programming seriously but I was looking at some YouTube videos and this fizzbuzz question came up. Do people actually have trouble solving fizzbuzz?

Is fizzbuzz an inside joke or something in the programming community or can I actually apply for a programming job being able to solve it? I only know python and some basic postgresql.

Attached: FA64CD44-0F44-4089-B638-C9127751D7FD.png (768x768, 60K)

Other urls found in this thread:

blog.codinghorror.com/why-cant-programmers-program/
coderbyte.com/
twitter.com/AnonBabble

its a very easy question
passing it doesnt mean you can get a job

The joke comes from people who swindled their way into large corporations as 'senior developer' by simply stapling together libraries for SalesForce or whatever, then they get laid off or exposed so they try and get another job as library stapler then can't solve fizz buzz.

So the answer is no you probably will not be able to get a job with zero portfolio, open source pull req history or any knowledge beyond fizzbuzz unless your cousin is hiring for Oracle or something.

So you're saying I need to have a github account, create some unique project and then put it on my resume and I'll have a chance at getting hired?

Even with a biology degree and not a C.S. degree?

>Even with a biology degree
If is different, if you have a different degree. Then, you should be ok to just be able to explain, why this is exceptional & good for the job you aim to get, as the people at the interview most likely do not have a clue how to read a single line of code. They would not even be able to understand what actually is within your portfolio, if you dont explain it to the most basic level.

I work as a business intelligence analyst and code basic stuff in VBA, python and SQL. My bosses and the people who hired me go crazy over this, yet would not be able to produce a "hello world" in VBA, if their life would depend on it.

>hey guys, I only know how to do fizzbuzz
>will that get me a programming job?

That's what you sound like

My impression was that FizzBuzz is a screening question for weeding out retards

I'm just wondering how much knowledge I need to apply for a programming job. What type of work do you do for python if you get a job involving python.

Can't I just look up most of the things if I don't really understand it yet 100%?

And I was asking if fizzbuzz was some kind of an inside joke or not.

Bruh are you autistic or does the dunning kruger effect manifest strongly in you?
You should be well aware of the reason why some people are having problems with it, not everybody has a brain programmed to do math

I'm wondering if fizzbuzz has any relation to actual programming or is it a meme question that is an inside joke. You don't have to be good at math to solve fizzbuzz that's fucking simple multiplication.

>that's fucking simple multiplication.

Attached: 1523832917004.jpg (385x382, 12K)

FizzBuzz is a way to determine whether you can structure a program to take preconfigured output and produce expected output. It's not to determine your skill level, it's to determine whether it's worth determining your skill level.

A lot of companies are willing to hire entry-level programmers to train to work within their ecosystem, but they won't hire someone that hasn't taken a basic course in programming, or taken the time to learn the basics themselves.

Being able to add 1 to a number is enough to do 99% of what programming is about, and even that is not necessary anymore since maps became popular outside of fp languages. You could be a competent programmer knowing literally nothing but arithmetics.

I did some test programming questions from this website, this one was listed as "easy".

>Have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.

Is my pic related a poor solution to this problem?

I had to look up chr and ord

Attached: sample.png (608x266, 11K)

Err now that i'm looking at it i think i put if y = "z" in the wrong place...

The point is that for some God forsaken reason 90% of programmers can't do it. It's the easiest of easy questions. Less than a small problem or even a tiny problem. It's minuscule. And yet most applicants will fuck it up, overcomplicate it, or show that they have no idea how to organize and write maintainable code. Often some Frankenstein abomination of the three. The point of fizzbuzz is to not waste the interviewer's time with a candidate that literally cannot write code at all.
blog.codinghorror.com/why-cant-programmers-program/

LOL

Damn, are you implying by that that I have no future in programming?

you fucked up the algorithm, it's not doing exactly what the spec says

can't post code block for some reason

Attached: aaaaaa.png (825x385, 22K)

sorry I misread your code, the if y = z then make it a won't work, you should consider why

I never heard of fizz buzz before this thread. This is what I came up with:
def fizzbuzz(n):
x="";
for i in range(n+1):
x="\t"+str(i)+"\t";
if i%3==0:
x = x + "fizz ";
if i%5==0:
x = x + "buzz";
print(x);

It's probably shit since I don't write code.

This is still wrong. If you are trying to show off then at least read the specification properly.

yeah, I realized that right after I posted.

I've only been programming for two weeks.

Attached: sample2.png (624x280, 11K)

more correct but there's still one thing wrong

You forgot 15.

Sadly I don't pay attention to your homework as much as you do.
Change whatever is in vowels to the letters before a vowel instead of the vowel then, same thing

What's wrong with that one?

Naw, it's cool: if the number is both divisible by 3 and 5, it adds both "fizz " and "buzz" to x. Here's the results.

Attached: 1515360160598.png (636x803, 16K)

function letterChanges(str) {
let result = [], c, i = 0;
while ((c = str.charCodeAt(i++)) >= 0) {
switch (c) {
case 122: case 90: c -= 25; break;
default: ++c; break;
}
switch (c) {
case 97: case 101: case 105: case 111: case 117:
c -= 32;
}
result.push(c);
}
return String.fromCharCode.apply(null, result);
}

actually that does work it's just a little strange how you use the y variable
in some cases you would assign something to y but not use it because str[i] is Z

Correction:
"use strict";

function letterChanges(str) {
let result = [], c, i = 0;
while ((c = str.charCodeAt(i++)) >= 0) {
if (
64 < c && c < 91 ||
96 < c && c < 123
) {
switch (c) {
case 122: case 90: c -= 25; break;
default: ++c; break;
}
switch (c) {
case 97: case 101: case 105: case 111: case 117:
c -= 32;
}
}
result.push(c);
}
return String.fromCharCode.apply(null, result);
}

True. I glanced over it.

I like the simplicity buy is 0 supposed to be a fizz buzz?

"use strict";
const moduloTestCases = {
"3": "Fizz",
"5": "Buzz"
};

function fizzBuzz(start = 1, limit = 100) {
const result = [];
for (let i = start; i

Dunno. Zero's a number, but it's easy to omit it since you just have to specify where the range starts in your for loop.

Yeah, I'm nowhere near that good.

You can't divide by zero.

If you have a biology degree you should look into biology related programming, e.g. protein folding problems, computational genomics, computational pharmacology - there are thousands of applications nowadays. Specialists with relevant education and some coding skills are vastly preferred over pure codemonkeys in these interdisciplinary areas, as it's much easier to teach the former to code than to impart all the field specifics onto latter. That being said, you should of course learn more than just Python and SQL, although it's a good start.

Attached: 1535275947649.png (770x775, 304K)

Yes, but you can divide 0 by 3 or 5. Zero can't be the divisor or the modulo.

Yeah but is the solution elegant or brute. I don't know shit.

So what else should I learn? Python is the easiest for me to read.

I have no idea of exact tools and I suspect it's highly dependent on particular research type. Go to your uni and ask around among faculty members and postgrads to get the picture. I'd say you should invest time into reading SICP thoroughly in any case.

It's one step away from elegance. It demonstrates you know how to think about a problem. I would have done it like this

if str[i].isalpha():
if str[i] == "z" or str[i] == "Z":
newstring += "A"
else
y = str[i]+1
if y == "a" or y == "e" or y == "i" or y == "o" or y == "u':
newstring += y.captialize()
else:
newstring += y
else:
newstring += str[i]
to avoid the uneccessary variable assignment

Yeah that is a better solution. Thanks.

for my $i (1..1000)
{
if ($i%3 == 0 && $i%5 == 0){
printf "$i\tFizzBuzz\n"; next;}
if ($i%3 == 0){
printf "$i\tFizz\n"; next;}
if ($i%5 == 0){
printf "$i\tBuzz\n"; next;}
}


Literally 5 minutes in Perl, and I'm not even an IT person. The last shit I did was some BASIC back in the early 2000's.

How the FUCK are there incompetents who can't do basic maths still in this field?

Wont that print fizzbuzz and fizz or buzz a second time?

If i%3 == 0 and i%%5 == 0:
Print ("fizzbuzz")
Else:
If i%3==0:
Print fizz
If i%5==0:
Print buzz

for i in range(100):
if i%3 == 0 and i%5 ==0:
print ("fizzbuzz")
else:
if i%3 ==0:
print ("fizz")
if i%5 == 0:
print ("buzz")

delet this riht nao

Attached: JCDenton.jpg (192x144, 6K)

No. "next" is Perl's "continue".

Ah ok thanks.

Python autism:

1) Range(len(foo)) - use enumerate(foo) instead. More readable and saves your ass from indexing your shit wrong somewhere.

2) Rename the parameter. 'str' shadows a built-in name.

3) "y in 'aeiyou'" or "y in {'a','e','i','y','o','u'}" would accomplish the same thing and be easier to work with. Want to make it case-insensitive? Right now, you'd have to write 'or y.lower() == somecrap' five times.

4) This is probably waaaays off from being a concern, but gluing strings piecemeal like that is inefficient as fuck; in cases like that it's better to make the newstring a list then use str.join to build the actual output once you're done appending stuff to it.

this board continues to amaze me, the hubris of programmers will forever be one of the wonders of the world.

So is this better?

Attached: sample3.png (463x316, 10K)

I tried my hand at it, but I don't know how good it is:
lamo Jow Forums is blocking my code snippet

Where do you find these exercises? My biggest problem learning coding was never having any exercises to practice on. The best I could find was some Arduino projects.

Attached: 1513641763718.png (613x440, 13K)

coderbyte.com/

No man, it doesn't work that way. Just do something you like, you'll know sooner or later if you like it or not. It's not about getting a job or not, if you're thinking like that, you're gonna have a very bad time.

If you really like it, you'll notice it:

Each time:
1) you discover a new possibility.
2) you fix a problem.
3) you created and finished a project.

You feel a rush and feel like a god. You get the feeling you have so much power nobody can say shit to you. It's basically like cocaine.

If you don't experience this, it just means you're not smart enough, and it's ok, we're not all made equal and you should know your place brainlet.

python jobs are mainly web backend programming, you are not going to do desktop programs with python

Is my code.

It feel good to solve something but I'm wondering if I have a future in this or am I a long way off from doing anything remotely useful.

I have a project in mind so I guess I'll keep coding until i finish that.

If you're already hyped on this, you'll probably get even more hyped when you start developing a game or a project with a database or network shizzle.

It's about the rush man. The feeling of creating something that's never made before. Automating stuff you never knew was possible.

Stuff that's been done a million times don't give you that rush. Making something new gives that rush.

>lamo Jow Forums is blocking my code
Could be noScript's XSS settings.

Might be. Trying the original post form instead of 4chanX told me that my IP range was blocked, so I gave up. A function I wrote that reads drivers licenses to determine drinking age also causes the same problem, so I'm guessing there's something that pisses off some security feature.
Guess I'll have to keep writing code to get a better estimate of what's causing it.

It blocked mine too. Said connection error.

If it's 4chanX, they blame it on CloudFlare. My first guess is it doesn't like the amount of arithmetic or it's too long.
Short snippets like :(){ :|:& };: seem to work.

Give us noobs some things to watch or read that are not introductory courses.

Is Structure and Interpretation of Computer Programs the next step?

I'm a complete beginner, how can I solve the problem more efficiently ? Just tried something quick :
n = int(input(" "))
i = 0
while(i

>Atom

You learn about optimizing later when you're advanced.

I'm a beginner too, what language are you learning and what are you watching and reading?

Okay, thanks I'll keep that for later
C and Python, Pratical C programming - O reilly,
The C programming Language, Ritchie Kernighan,
And other sources but in french

I've seen it used to weed out liars. India has a work culture of claiming to be an expert on everything because they're manager told them to say that. One trick is to just change the words Fizz and Buzz to something else like Alpha and Beta so they have a harder time to google it if it's over the phone. One guy we gave that question to went silent for 5 minutes before finally starting to code. Then after another 5 minutes he came up with something like this.
i = 0
while (i

Isn't it supposed to print every number between 1 and 100 and not just the ones divisible by 3 or 5?

My original code will print the numbers that won't fizz or buzz. This thread rekindled my interest in scripting and the results I posted was me fooling around with logical operators.

That works doesn't it?

>Aside from the 'i' part, it is the right answer
He literally printed the letter 'i' instead of the value of i. Also see the other red flags that made us not take him.

Mostly. It looks like it only prints the number if it's not a multiple of 3 or 5.

Wow C is so much faster than Python : ~ 1.5s for 1 000 000, while python takes nearly 6s for 1000 ->
FizzBuzz : 66
Fizz : 267
Buzz : 134
FizzBuzz+Fizz+Buzz : 467
5.780718564987183 s elapsed

Attached: Capture d’écran_2018-09-25_03-01-13.png (701x392, 31K)

Ah I thought print 'I' was a typo and supposed to be (i)

What, how did you even manage that?
$ time python ttest.py > /dev/null && time python ttest.pyc > /dev/null && time ./main.exe > /dev/null;

real 0m0.605s
user 0m0.530s
sys 0m0.061s

real 0m0.557s
user 0m0.546s
sys 0m0.015s

real 0m0.227s
user 0m0.218s
sys 0m0.000s


Even compiling python again doesn't make it take that long.

I wanna learn C, but it's mostly to write AVR code.

Is that for 1000 iterations?

1000000 iterations
#!/bin/python
for i in xrange(1000000):
if i % 3 == 0:
if (i % 5 == 0):
print 'FizzBuzz'
else:
print 'Fizz'
elif (i % 5 == 0):
print 'Buzz'
else:
print i


#include

int main() {
for (int i = 0; i < 1000000; i++) {
if (i % 3 == 0) {
printf("Fizz");
if (i % 5 == 0)
printf("Buzz");
putchar('\n');
} else if (i % 5 == 0) {
printf("Buzz\n", i);
} else
printf("%u\n", i);
}

return 0;
}

What books would you guys recommend for beginners?

for i in range(101):
if i % 3 == 0 and i % 5 == 0:
print("niggerlover")
elif i % 3 == 0:
print("nigger")
elif i % 5 == 0:
print("lover")
else:
print(i)

Unironically mine is the best 0-100 fizzbuzz since I stole print(i)

Beginner of what? Python??

I like Tim Buchalka's class on udemy for $10.