Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,161,824 members, 7,848,314 topics. Date: Sunday, 02 June 2024 at 08:27 PM

I Want To Learn Programming. Which Language Should I Start With? - Programming (25) - Nairaland

Nairaland Forum / Science/Technology / Programming / I Want To Learn Programming. Which Language Should I Start With? (665058 Views)

As A Computer Science Student,which Language Should I Start Learning / Which Programming Language Should He Go For? / I Want To Learn Computer Programming, What Language Should I Learn First? (2) (3) (4)

(1) (2) (3) ... (22) (23) (24) (25) (26) (27) (28) ... (165) (Reply) (Go Down)

Re: I Want To Learn Programming. Which Language Should I Start With? by DharkPoet(m): 7:29am On Sep 21, 2013
doziej84: pls someone should use python language to write a working code for this.
i'm currently learning python & finding this difficult. thanks

What is the sum of the even numbers from 524 through 10508, inclusive? Hint: write a while loop to accumulate the sum and print it.
For maximum learning, do it with a for loop as well, using range.

this should suffice, I didn't run this on a PC, to know if it would actually be correct, but I think it should, besides it's written in java, just understand how it works, then use it with your python syntax.

public class addNum{
public static main (String args [] ){
int counter = 0 ;
int i;
for (i=524 ; i<=10508; i++){
if(i%2==0){
System.out.println(i) ;
counter+=i ;
}
}
System.out.println(counter);
}
}
Re: I Want To Learn Programming. Which Language Should I Start With? by Knownpal(m): 9:02am On Sep 21, 2013
DharkPoet:

this should suffice, I didn't run this on a PC, to know if it would actually be correct, but I think it should, besides it's written in java, just understand how it works, then use it with your python syntax.

public class addNum{
public static VOID main (String args [] ){
int counter = 0 ;
int i;
for (i=540 ; i<=10508; i++){
if(i%2==0){
System.out.println() ;
counter+=i ;
}
}
System.out.println(counter) ;

}
}
}
hmmm am I rig?
Re: I Want To Learn Programming. Which Language Should I Start With? by dsypha(m): 9:50am On Sep 21, 2013
DharkPoet:

this should suffice, I didn't run this on a PC, to know if it would actually be correct, but I think it should, besides it's written in java, just understand how it works, then use it with your python syntax.

public class addNum{
public static main (String args [] ){
int counter = 0 ;
int i;
for (i=540 ; i<=10508; i++){
if(i%2==0){
System.out.println(i) ;
counter+=i ;
}
}
}
}


Dude!!! he said Python not Java
Re: I Want To Learn Programming. Which Language Should I Start With? by Ajibel(m): 11:01am On Sep 21, 2013
Keep on wondering what someone else has used python to do... E ma kpe nbe tongue
If you dunno what to create with python, dump it for java or php
Re: I Want To Learn Programming. Which Language Should I Start With? by kennikazi(m): 11:05am On Sep 21, 2013
all4naija:

Good. It is a gradual process though. Python is easy and clean programming language. There are thousands of models out there for you to use and modify if you are finding things to create on your own too difficult. Defining and calling objects is one of the easiest parts of Python, as it is object oriented language. Function is an expression in the Python definitive point of view. That is not actually something difficult to struggle with. If you have any problem with anything at all just post it here and somebody will help you out. I can as well be of help.

Thank you.
Yap...ayav a problem which I posted in the previous page buh no one answered it. So i just abandoned it.....until now grin grin
=============================================================================================
Please all the python chairmen in the hauz, I need u help o!
I am currently reading C.H Swaroop's 'Byte of Python' and I am having problems with the part where we have to create a backup script.
We were instructed to back up a list of files (here we created a list that contained the directories of those files) to another directory (in this case, those different files will be backed up in another directory and then zipped up).
Now we downloaded something like a zip command that adds the backed up files to a .zip archive. My problem here now is that, after following every instruction to the letter, I still get an error saying 'the filename, directory name or volume label syntax is incorrect'.
Is there a simpler way of creating this script without any complexities or downloading any software
Re: I Want To Learn Programming. Which Language Should I Start With? by Nobody: 1:39pm On Sep 21, 2013

import time

#####################
beginNumber=524
endNumber=10508
#####################

def calc_While(alpha, omega):
#init params
starter=alpha
ender=omega
#theSum will hold answer and let init it with starter
theSum=starter;
#lets see how much time this took
preTime=time.time()
while True:
#we are in the loop so lets upgrade starter with 2, since we are even
starter+=2
#add to the answer
theSum+=starter
#check if starter is now ender, so we kill the loop
if starter==ender:
break
#now lets assume a mumu enters insane values, we need to tell him and return 0 as answer
if starter==ender or starter>ender:
print "Invalid parameter ranges!"
theSum=0
break
#so how much time did it really take
timeSpent=time.time()-preTime;
#seeing is believing
print ("Ans="+str(theSum)+" time taken="+str(int(timeSpent*1000000))+" microsecond" )




def calc_ForRange_UNoptimized(alpha, omega):
#init params
starter=alpha
ender=omega
#theSum will hold answer and let init it with 0 since we are relying on for loop
theSum=0;
#lets see how much time this will take
preTime=time.time()
#if we subtract the max from min, we will off by 1 loop because the range starts from 1, so lets add 1 to it
for x in range(ender-starter+1):
if x%2==0:
theSum+=(starter+x)
#so how much time did it really take
timeSpent=time.time()-preTime;
#seeing is believing
print ("Ans="+str(theSum)+" time taken="+str(int(timeSpent*1000000))+" microsecond" )





def calc_ForRange_optimized(alpha, omega):
#init params
starter=alpha
ender=omega
#theSum will hold answer and let init it with 0 since we are relying on for loop
theSum=0;
#lets see how much time this will take
preTime=time.time()
#if we subtract the max from min, we will off by 1 loop because the range starts from 1, so lets add 1 to it
#we are going to use the built-in step param of range
for x in range(starter,ender+1,2):
theSum+=x
#so how much time did it really take
timeSpent=time.time()-preTime;
#seeing is believing
print ("Ans="+str(theSum)+" time taken="+str(int(timeSpent*1000000))+" microsecond" )


def Calculate():
calc_While(beginNumber,endNumber)
calc_ForRange_UNoptimized(beginNumber,endNumber)
calc_ForRange_optimized(beginNumber,endNumber)
#bottomline, it is better to read the doc and use built in methods cos it is obviously *6 faster


if __name__ == "__main__":
Calculate()

the result
Ans=27541388 time taken=5000 microsecond
Ans=27541388 time taken=6000 microsecond
Ans=27541388 time taken=999 microsecond


Ajibel: Keep on wondering what someone else has used python to do... E ma kpe nbe tongue
If you dunno what to create with python, dump it for java or php
the language does not create stuff, the programmer does.
blowing big grammar at the village square wont work any better than speaking yoruba to a whiteman
use the languages where needed

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by DharkPoet(m): 9:25pm On Sep 21, 2013
DharkPoet:

this should suffice, I didn't run this on a PC, to know if it would actually be correct, but I think it should, besides it's written in java, just understand how it works, then use it with your python syntax.

public class addNum{
public static main (String args [] ){
int counter = 0 ;
int i;
for (i=524 ; i<=10508; i++){
if(i%2==0){
System.out.println(i) ;
counter+=i ;
}
}
System.out.println(counter);
}
}

this is the modified code, it works, like I said it was written in java, just check the process and use the corresponding python syntax
Re: I Want To Learn Programming. Which Language Should I Start With? by bonsoirval: 2:27pm On Sep 23, 2013
adewasco2k:
i think you must use HTML and maybe CSS, then you can apply your python to that

facebook can be a combination of many languages, or just one. but php, html, css and mysql rapour better
Re: I Want To Learn Programming. Which Language Should I Start With? by bonsoirval: 2:29pm On Sep 23, 2013
adewasco2k:
i think you must use HTML and maybe CSS, then you can apply your python to that


php, html, css, mysql and maybe javascript
Re: I Want To Learn Programming. Which Language Should I Start With? by Ajibel(m): 8:44pm On Sep 25, 2013
Na wa oo°°oo. Many Android threads nau. Seems that's the latest among programmers & am not a mobile app devt enthusiast embarassed
Re: I Want To Learn Programming. Which Language Should I Start With? by Nobody: 8:46pm On Sep 25, 2013
bonsoirval:


php, html, css, mysql and maybe javascript
I think the extensions are written in different programming languages.
Re: I Want To Learn Programming. Which Language Should I Start With? by Nobody: 8:59pm On Sep 25, 2013
kennikazi:
Yap...ayav a problem which I posted in the previous page buh no one answered it. So i just abandoned it.....until now grin grin
=============================================================================================
Please all the python chairmen in the hauz, I need u help o!
I am currently reading C.H Swaroop's 'Byte of Python' and I am having problems with the part where we have to create a backup script.
We were instructed to back up a list of files (here we created a list that contained the directories of those files) to another directory (in this case, those different files will be backed up in another directory and then zipped up).
Now we downloaded something like a zip command that adds the backed up files to a .zip archive. My problem here now is that, after following every instruction to the letter, I still get an error saying 'the filename, directory name or volume label syntax is incorrect'.
Is there a simpler way of creating this script without any complexities or downloading any software

This is an avenue for you to look further by searching for where the error is emanating from by revisiting your lines of command associating with that directory in your program. You should look out for slashes, backslashes, quotes,double quotes and how they affect your strings, integers,etc pointing to that directory. It would be nice you post your case here for us to see.

I do not know if there is any simpler way not until I see your problem first.
Re: I Want To Learn Programming. Which Language Should I Start With? by vinkela(m): 2:24am On Sep 27, 2013
*/
public static void main
(String[] args) {
int N; // One
of the integers whose
divisors we have to
count.
int maxDivisors; //
Maximum number of
divisors seen so far.
int numWithMax; //
A value of N that had the
given number of divisors.
maxDivisors = 1; //
Start with the fact that 1
has 1 divisor.
numWithMax = 1;
/* Process all the
remaining values of N
from 2 to 10000, and
update the values
of maxDivisors and
numWithMax whenever
we
find a value of N
that has more divisors
than the current value
of maxDivisors.
*/
for ( N = 2; N <=
10000; N++ ) {
int D; // A
number to be tested toa
see if its a divisor of N.
int
divisorCount; // Number
of divisors of N.
divisorCount = 0;
for ( D = 1; D <=
N; D++ ) { // Count the
divisors of N.
if ( N % D == 0 )
divisorCount+
+;
}
if (divisorCount >
maxDivisors) {
maxDivisors =
divisorCount;
numWithMax =
N;
}
}
System.out.println
("Among integers
between 1 and 10000,"wink;
System.out.println
("The maximum number
of divisors is " +
maxDivisors);
System.out.println
("A number with " +
maxDivisors + " divisors
is " + numWithMax);
} // end main()
}
Re: I Want To Learn Programming. Which Language Should I Start With? by thenabster(m): 4:18am On Sep 27, 2013
sum=0;
for i in range (524, 10508):
if(i%2==0):
sum+=i
print sum
Re: I Want To Learn Programming. Which Language Should I Start With? by dokunbam(m): 3:58pm On Sep 28, 2013
I need to bookmark this
Re: I Want To Learn Programming. Which Language Should I Start With? by marlockj: 4:18pm On Oct 01, 2013
hi
Re: I Want To Learn Programming. Which Language Should I Start With? by Ajibel(m): 4:27pm On Oct 01, 2013
marlockj: hi

hello grin grin
Re: I Want To Learn Programming. Which Language Should I Start With? by BroJ: 10:25pm On Oct 01, 2013
taah
Re: I Want To Learn Programming. Which Language Should I Start With? by just1k: 11:25pm On Oct 02, 2013
This trend is one of the most resourceful in Nairaland, I love what you're doing guys!!! wink
Re: I Want To Learn Programming. Which Language Should I Start With? by dokunbam(m): 3:04pm On Oct 05, 2013
i started with JAVA somedays ago and i think am getting well on it
But the problem i have now is that some of the code written on the material are somehow different wen i work on java IDE


we can chat on any of these social media platform and help me out
yahoo
facebook
google
skype
whatsapp

but google and skype will be better
i dont want pple disturbing me on FB

pls PM and i will send my id
Thanks

I cant do it alone
Re: I Want To Learn Programming. Which Language Should I Start With? by dokunbam(m): 3:16pm On Oct 05, 2013
..
Re: I Want To Learn Programming. Which Language Should I Start With? by dsypha(m): 11:58pm On Oct 05, 2013
dokunbam: i started with JAVA somedays ago and i think am getting well on it
But the problem i have now is that some of the code written on the material are somehow different wen i work on java IDE


we can chat on any of these social media platform and help me out
yahoo
facebook
google
skype
whatsapp

but google and skype will be better
i dont want pple disturbing me on FB

pls PM and i will send my id
Thanks

I cant do it alone

drop your nom, lemme add you to a java whatsapp group, a serious learner really don't need an IDE! Learn d hard way! Notepad && Command prompt.!!

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by bigdot1759(m): 8:40pm On Oct 13, 2013
pls how can i learn python

(1) (2) (3) ... (22) (23) (24) (25) (26) (27) (28) ... (165) (Reply)

(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. 47
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.