Cont. of I've been learning Python on and off for about 6 months now and Linux for 2 months. I'm pretty good automating things on my vps in Python scripts. Here's an example of my attempt to solve fizzbuzz:
for i in range(1,100): x = i / 15 if x == int(x): print ("fizzbuzz") else: x = i / 5 if x == int(x): print ("fizz") else: x = i / 3 if x == int(x): print("buzz") else: print(i)
That's just a technicality, not a code problem. I would imagine that I'm above at least 50% of people who get hired simply with my code alone.
Julian Rivera
Don't call us, we'll call you. Security will escort you out.
Sebastian Sanders
Im serious. It literally took me 5 seconds to come up with that fizzbuzz solution and 1 minute to write it. I've seen the other solutions before, when I was watching YouTube videos but haven't looked at it in a while.
I'm not trying to brag but surely it can't be that bad that no one would hire me?
Kevin Morgan
Cunt fuck off. This isn't your blog why the fuck aren't mods banning this garbage.
Ryder Russell
im sure your trolling but you will never get questions this easy in an interview. if you want examples filter leetcode by medium/hard to get an idea of the type of questions they'll be asking you.
Zachary Baker
...serious question! how much codelines you wrote in this time period? just asking because in the same situation but different project.
try: [print("fizz" * (not i%3) + "buzz" * (not i%5) or i) for i in range(1,101)]
Nathaniel Evans
OP, I thought we sufficiently told you to fuck off in the last thread. Your fizzbuzz is just godawful.
Ethan Barnes
I mean, I'm just a hobbyist, but three nested if statements seem rather messy for a simple fizzbuzz. Also what's the benefit of using the int check over modulos (provided you don't use an integer division, like already pointed out, and your fizzbuzz actually works)?
Landon Scott
are you even trying
for i in range(1,101):print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)
Jacob Butler
>nested if statements Is there something wrong with that?
for i in range(1, 101): if x % 15 == 0: print("fizzbuzz") elif i % 5 == 0: print("buzz") elif i % 3 == 0: print("fizz") else: print(i)
Nolan Kelly
It works, but it's rather confusing. Python offers elif for a reason.
Xavier Watson
Can you do it my way using elif?
Blake Reed
Your way is absolutely retarded, but here you go
for i in range(1, 101): if x / 15 == int(x): print("fizzbuzz") elif x / 3 == int(x): print("fizz") elif x / 5 == int(x): print("buzz") else: print(i)
Logan Bell
Ah yes I see. Thanks.
Adam Allen
Replace x with i but yeah
Matthew Hill
This is the most perfect version of FizzBuzz.
Austin Nelson
this is the only acceptable solution
Lincoln Morgan
Here a version that actually works. for i in range(1, 101): if i/15. == int(i/15.): print("fizzbuzz") elif i/5. == int(i/5.): print("buzz") elif i/3. == int(i/3.): print("fizz") else: print(i)
Parker Hall
> x = i / 15 if x == int(x): what the fuck
William Allen
Python 3 doesn't truncate integer division any more, get with the times grandpa.
Jaxson Smith
>"Look at my answer to a standardised programming test" >Your answer is flawed >"Yeah I knew that, I could have got it right if I wanted to"
Jesus Christ you must have employers lining up to hire you
Cooper Phillips
Just read the previous thread, if you want to get a glimpse of how OP thinks of himself. He actually believed that some script that read files and queried a database for usernames contained in the file was some enormous feat he had accomplished.
Luke Morales
My bad. I forgot that I changed my default Python version from 3.6 to 2.7 at some point in the past.
Luis Bailey
I don't know python, only js (I'm a beginner). Isn't the X undefined in this one? Should that say i also?
Dominic Jenkins
Yes
Juan Miller
Where's your fizzbuzz, genius?
Daniel Jones
Here and here , although you should replace i with x or vice versa.
I also posted in the previous thread
Daniel Martinez
Ok, you get a pass for now. Otherwise you were on the verge of a verbal lashing.