My Experience: Python vs Java

in #java6 years ago

images (2).jpg

During my 1st year holiday I sat down at home and taught myself Java. I made use of this book
Java How To Program Ninth Edition by Paul and Harvey Deitel
Netbeans (Java IDE) Integrated Development Environment, the internet and my head. When people say Java is hard I just laugh because I see nothing wrong with it I learnt it myself and it was fun Ivan tell you that. If you are being held by this just give it a try and you will be amazed. This I promise. The only problem I see is that it is verbose i.e it contains a lot of lines of code. Just to solve a simple problem you will have to write codes that really are not important to your main problem. This is where this post is based on.

When I started my second year we were told we would be doing python. I was excited because I was going to learn another language and not just be based completely on Java. Yesterday, 14/7/2818 we wrote our test and before that we had a pratical where we were told to write a python code to solve a problem we all had different questions.
Coincidentally, the same question was repeated for me.
The question was to print even numbers between 1and 20. I know it's very easy to do but I want to take note of the difference in the length of the codes.
These are my codes;
Practical Test;

i = 2
while i<=20:
print i
i+=2

Main Test;

for I in range(2,21,2):
print I

Although when I wrote the first python code I was not as proficient as when I wrote the second. This is how I would write the Java code

class Test{
public static void main(String [] args){
int i = 2;
while (i<=20){
System.out.print( i);
i+=2;
}//ends while
}//ends main method
}//ends Test class

Or

class Test{
public static void main(String [] args){
for(int I; I<=20;i+=2)
System.out.print (I);
}//ends for statement
}//ends class Test

With this experience if I was asked who would be faster in a competition I'd choose the Python programmer. He has got to be faster with just a few lines of code than the Java coder.

I don't know which is better but I reckon that if u want to get something done with the speed of 💡 you go with python.

Sort:  

If you were to chose, would you learn Python or Java first?

Sincerely, I don't know right now because I had a chance to choose and still went for Java. Don't just seem to know why

Coin Marketplace

STEEM 0.20
TRX 0.25
JST 0.039
BTC 97530.27
ETH 3454.73
USDT 1.00
SBD 3.06