Old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
github.com
twitter.com
...
>you will never be a cute programmer loli
Maid Dragon. MC is an OL programmer.
Cool, I guess I'll just try doing some exercises from CLRS, or something, in C++.
>old awful language
heh
>Posted before the bump limit
Delete this invalid thread.
'Tis more important to be a skilled programmer than it is to be cute.
Post the most complicated and over-engineered fizzbuzz
for i in range(1, 100):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
why fucking live
>tfw all the money is in either java or webdev feels bad man
Poker player here.
I wanna write a program that generates random hands for me for practice.
What is a good program
Task:
>if the letter "a" appears in a string you should print to output "letter found!"
>but if the letter b is in the string, you should report it first than the letter a
>also indicate at which position you found the letters
WHAT THE FUCK
>Poker player here.
online?
Write your own, it's not very difficult.
I'd get into their LLVM, if you know what I mean
I mean that wrongly. What language should I use?
Online and offline.
nice simple task. what's the issue?
luscious loli vaginal manko?
the question is if you have the string "aab", you have to go backwards?
Any. There should be no difference, unless you choose brainfuck or something.
Which ever you feel most comfortable with.
Me on the right.
if 'b' in string:
print(letter b found)
print(string.index('b'))
elif 'a' in string:
print(letter a found)
print(string.index('a'))
[\code]
If you are using python
print("\n".join(('', 'fizz')[i%3 == 0] + ('', 'buzz')[i%5 == 0] or str(i) for i in range(1,101)))
>elif
;^)
thread image downloader in python. works pretty well. could've been better.
>luscious loli
you are repeating yourself here
>vaginal manko
you are repeating yourself here
DRY
The best :^)
10 LET I = 1
20 LET S$ = ""
30 IF I > 100 THEN GOTO 900
40 LET A = I
50 LET B = 3
60 GOSUB 400
70 IF A = 0 THEN GOSUB 500
80 LET A = I
90 LET B = 5
100 GOSUB 400
110 IF A = 0 THEN GOSUB 600
120 IF S$ = "" THEN GOTO 150
130 PRINT S$
140 GOTO 160
150 PRINT I
160 LET I = I + 1
180 GOTO 20
400 IF A < B THEN GOTO 430
410 LET A = A - B
420 GOTO 400
430 RETURN
500 LET S$ = S$ + "FIZZ"
510 RETURN
600 LET S$ = S$ + "BUZZ"
610 RETURN
900 END
learn programming logic it will help
What is wrong with elif or do you just hate python?
top pleb
watch this
for i in range(1,101):print"FizzBuzz"[i*i%3*4:8--i**4%5] or i
What the hell do I program when i have 5+ years experience front/backend on a long weekend bored out of my mind.
Internet 3.0
read the problem description haha
hehe
Is Twilio the go to for sending SMS?
C
What language are you using?
You don't have to check letter by letter.
Just check the entire string at once if it contains X character.
I'd just iterate through the string once, recording all positions of both a and b in an array, and then reporting them afterwards, first the indices of occurences of b, then the same for a. Not sure if that's what the problem's asking though.
Java is the best programming language.
nani?
kami desu ka?
the thing is, you cant go backwards, you are iterating through each character from left to right
It would help a lot if you just tell us what language your professor asked you to do your homework in dipshit.
Also you are not going backwards. You are recording their position and then checking if b is in the array before reporting b and a.
Is (((LISP))) anti-Semitic?
Alternative
print("\n".join((str(i), 'fizz', 'buzz', 'fizzbuzz')[(i%3 == 0) | (i%5==0)
it's in flex (the fast lexical analyser generator)
Use indexOf to check if a string contains a certain substring.
Only anarchic languages do you have to parse through each letter.
>Punctuation is anti-Semitic
Why are Jews always on the lookout for ways to play the victim?
神じゃない、ばかだけ。
Not any of the people who have posted yet, but you're an idiot, just letting you know. Just because your program description says if doesn't mean you can't use an else if statement. I can't fathom how much regret your mother has for not aborting you.
>2017
>python2
pleb
Sup Forums please go /dpt/ is a very diverse community who's sole focus is on programming
Anonymous Distributed Sup Forums clone
if you don't wear programming socks and write in ISO C90 exclusively, you're not welcome here
Each check will internally loop over the string, so you are looping twice, which is slower than just looping once.
4 (you)
>do i fit in yet, guise xDD
True. But clearly that is a homework assignment and I doubt looping over a string twice is worth writing more code than looping once.
Human Resource Machine?
I only program in a g string and low assembly machining languages
Are you serious? If there's a 'b' and an 'a' in the word, it will only report that there's a 'b'. It should be two if statements.
you can only loop once from left to right.
and yet you have to report things found on the right before left
how's that possible
so what do you program in if you're naked? binary?
*/dpt/ is a transgender white nationalist support group with an emphasis on programming
If it's homework then it is worth writing because just looping twice is lazy and won't teach you whatever your teacher was trying to go for when they left you that assignment.
You are probably supposed to solve it using dynamic programming even.
There are these things called variables that can store data for you, so you can use then at a later time.
Looping twice is lazy and correct way to do it.
To loop once
>Loop once
>Record shit in Array
>Check array
>Report shit
Loop twice
>Check for B
>Report B
>Check for A
>Report A
There you go
exactly!
I am fully clothed with a jacket on and shoes on programming in Java and then remove lairs of clothing based on the programming language
I am pretty sure it's multicultural
You are still looping over the array afterwards. You are just making your code more complicated.
I primarily program in ISO C11, C++14, and Ruby. I have recently been toying around with F#, and have been working in some x86_64 assembly for my security assignment.
I wear black crew socks.
I am a cisgender male Libertarian programmer.
The lower level the language, the fewer the layers.
Rust is this weird programming language where you wear a shirt and a coat and a hat but no pants.
>I am a cisgender male Libertarian programmer.
then this place is not for you, only girls are allowed here
i want to build an assembly compiler.
how far does the rabbit hole goes?
are you at least full on ancap? If not, you're not welcome here.
Yes but the array is smaller and only supposed to have two variables. Heck, you don't need an array, just two variables defaulted to -1 and set to the position of b and a respectively if found.
It is more complicated but it is what you are expected to do if you are writing an OS. You don't want Linus yelling what a moron you are through mail.
You are probably a webdev.
Not very far
>Flex
>Writing an OS
????
How many more of these books are there? I found the LLVM one on amazon.
If you are using a needle, a looking glass and a disk plate, you are probably an undead zombie or Grace Hopper.
i hope it's in assembly and not some pleb bullshit
now this anime i can FAP to
Except once your code gets more complex with more substrings to track, your array gets larger and needs to be manually updated all the time.
While searching for a single substring and printing it can be wrapped into a function and reused multiple times.
Quick, program a clock that will print the time every second.
now=$(date +"%T")
echo "Current time : $now"
Imagine if an authoritative book on computing was plastered with anime girls.
Where do I find "Idea guys"? I'm a dev that can be picky and looking .
As soon as Japan writes one. They put anime on fucking everything, even supposedly high brow literature.
professional idea guy here
ask me anything
python
__import__('datetime').datetime.now().strftime('%H:%M:%S')
Have you checked your local liberal arts or business faculties?
There's two others apart from the ones in the last two /dpt/ threads. It seems most of them were only distributed at Comiket.
Pretty sure most posters here are just men.
An assembler? Those aren't that difficult.
No. I'd rather not have my country get destroyed by the Chinese and the Russians. A proper government is necessary to reasonably defend the people from foreign powers.
>the visual c compiler only supports ANSI C
fuck you microsoft I want my VLAs
just use malloc you shit
it's 2017, men can be girls too
>only girls are allowed here
that's right! only cute lolis allowed!
This, If you don't identify as a cute 2d loli you don't belong here