[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
How do I git gud at programming? I understand the concepts but
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /adv/ - Advice

Thread replies: 12
Thread images: 1
File: image.jpg (19 KB, 250x185) Image search: [Google]
image.jpg
19 KB, 250x185
How do I git gud at programming? I understand the concepts but when it building a program for homework assignments I usually just stare at the screen not knowing what steps to take. I'm pretty solid with my math classes but for some reason baby's first programming course is a pain in the ass for me.
>>
>>16859024
You keep trying until you've got the result you wanted.

You can't think and plan perfect code that will Work 100% from thought alone.

You get an idea and you start adding to it a little bit at a time
>>
Give an example of a program you have to write.

What functions will you need? What are the outputs?
>>
Here are some random ideas

1) Having an idea, and just trying a lot of things to make it work
2) Having deligence to simplify your ideas, even if your first incarnation is not perfect you can make it better
3) Having a good environment. A lot of people fail at this step because, for example, working with IDEs and complex GUI environments is difficult because it's hard to organize libraries/dependencies, and on the flipside, but doing everything from the command line, although arguably better, has a steeper learning curve

anyways, if you have a specific language it might help add more context
>>
Thanks for the replies. I have to use Java is that helps at all.

>>16859030
Yeah this seems to work most of the time I guess I'm just more worried about exam time when I have to get everything right the first time. I've started to write out flowcharts and it helps a bit.
>>16859046
I have to write a program that requires me to find the number of sevens between two numbers. Ex. 100-150, there are 5 7s (107,117,127,137,147), but for 100-180, there are 9, because 177 counts for two sevens. I figure I should use mod using a for loop but other than that I'm pretty lost.
>>
>>16859115
this is a very common beginners problem.

basically, how do you "get" a digit in a number?

the trick is to use modulus AND division (at least this is how it is in most textbooks), specifically, using INTEGER division, which knocks off the remaining

so

177 mod 10 = 7 <-- count a 7 here
177/10 = 17
17mod 10 = 7 <-- count a 7 here
17/10 = 1
1mod10 = 1 <-- not a seven here
>>
>>16859300
remainder **
>>
>>16859115
A do while will solve your problem. Do (starting number +7) while(starting number less than goal number) and each time you loop through the Do black, just add one to a running count and output the count at the end. Any questions, class?
>>
>>16859115

It sometimes helps to write it out in pseudo code after figuring out the individual steps on paper.

You need to check every digit of every number in the sequence. So something like:

for [number] in all numbers between 100 and 150:

for [digit] in all digits in [number]:

if this digit == 7, add one to your count
>>
>>16859024
What do women think of this:
http://www.menarebetterthanwomen.com
>>
>>16860003
Shit. Wrong thread.
>>
There was a particular class in college that just made things click for me. The most similar thing I can find that's generally available is the book "Seven Languages in Seven Weeks": a crash course on a whole bunch of different languages at once.

The reason the class worked for me is that having to deal with so many languages so quickly forced me to learn to look beyond the constraints of language, or even paradigm. The book may help do the same for you,
Thread replies: 12
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.