Jump to content

Python or c++?

I'll be studying computer engineering next semester. In preparation for this I want to get familiar with one of the coding languages that I will be using. Should I start with c++ or python? I have some knowledge about javascript, but not much more coding experience than this.

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, DeagleMaster said:

I'll be studying computer engineering next semester. In preparation for this I want to get familiar with one of the coding languages that I will be using. Should I start with c++ or python? I have some knowledge about javascript, but not much more coding experience than this.

I'd definitely start with Python. With C++, you'll have to do a ton of boring tasks yourself, but which don't really advance your programming-skills that much, like e.g. manually having to handle all memory-allocations and such. With Python, you get to focus more on the actual logic you are doing and practicing the concepts, so I'd say it's the way to go in the beginning.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

At some point definitely learn C++ since it teaches you concepts that are not available in other programming languages. You can make better informed decisions as a programmer because you know how things work behind the scenes in other languages. However, I would recommend starting with Python since for you at this point it is more important to learn how to program rather than writing a bunch of boilerplate. 

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

Which C variant one should learn first is an argument of its own.  I would argue it is important to learn C++ and then move to C and C# when necessary. At least, that is the path I am going down.

 

That being said, C and its variants are low level languages and are compiled. They are often considered fastidious because of this, but offer lower level access to hardware and are typically faster. Python on the other hand is an interpreted language. As such, as long as python is installed on the computer you are using, your program should just work. Also, python handles a bunch of the tedium and lets you just work toward a goal. 

 

Ultimately, it just comes down to preference. If you are a person that really likes to dig in and get difficult things out of the way first (getting beat up every step of the way) go with C++. If you just want to be writing programs quickly to solve fun problems, then pick up a book like Python Crash Course by Eric Matthes, and you will have the core of the language down in a couple of weeks.

Link to comment
Share on other sites

Link to post
Share on other sites

29 minutes ago, DeagleMaster said:

I'll be studying computer engineering next semester. In preparation for this I want to get familiar with one of the coding languages that I will be using. Should I start with c++ or python? I have some knowledge about javascript, but not much more coding experience than this.

 

I would advise you to start with C, or C++, definitely, as it is a statically typed language unlike Python and JS, and many things related to how computers perform are "hidden" from the user in Python. Python is great, no doubt, but seeing that you are a computer student, getting a leg up in learning about how a programming language interacts with a computer is essential. If you do this, and afterwards if you learn Python, you will understand a lot about why Python does this and that, and what it hides from the user to make it a simpler language. Not only will you gain much more knowledge by starting out with C/C++, but you will also grow an appreciation towards stuff like this when you understand the nitty-gritties.

 

For me, I started with QBasic, and then a bit of Java in high school, and then learned bits of C and Python parallelly, I definitely appreciate the insider knowledge that I have the now. And if I started with Python, learning C or C++ would seem harder just because I wouldn't have been accustomed to how computers and programming languages "really" work.

 

PS: if you start right away, within a month or so, you'd get a good understanding of the absolute basics of C/C++, that way it wouldn't hinder your progress in actually learning to code when you have other subjects to study along with it; like @trag1c said, it's pretty important to learn how to program, and is more important if you just need to know how to code and the nitty-gritties don't matter to you, or won't be useful in your curriculum.

Attention is what makes life meaningful.

Also, please quote me for a reply. 🙂

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, OrangeSunshine said:

Which C variant one should learn first is an argument of its own.  I would argue it is important to learn C++ and then move to C and C# when necessary. At least, that is the path I am going down.

 

That being said, C and its variants are low level languages and are compiled. They are often considered a fastidious because of this, but offer lower level access to hardware and are typically faster. Python on the other hand is an interpreted language. As such, as long as python is installed on the computer you are using, your program should just work. Also, python handles a bunch of the tedium and lets you just work toward a goal. 

 

Ultimately, it just comes down to preference. If you are a person that really likes to dig in and get difficult things out of the way first (getting beat up every step of the way) go with C++. If you just want to be writing programs quickly to solve fun problems, then pick up a book like Python Crash Course by Eric Matthes, and you will have the core of the language down in a couple of weeks.

C isn't a low level language. It's a high level language. Everything else, I perfectly agree with.

Attention is what makes life meaningful.

Also, please quote me for a reply. 🙂

Link to comment
Share on other sites

Link to post
Share on other sites

26 minutes ago, DeagleMaster said:

I'll be studying computer engineering next semester. In preparation for this I want to get familiar with one of the coding languages that I will be using. Should I start with c++ or python? I have some knowledge about javascript, but not much more coding experience than this.

 

start with C. Not the horrible abomination that is c++. Try C. 

Link to comment
Share on other sites

Link to post
Share on other sites

20 minutes ago, WereCatf said:

I'd definitely start with Python. With C++, you'll have to do a ton of boring tasks yourself, but which don't really advance your programming-skills that much, like e.g. manually having to handle all memory-allocations and such. With Python, you get to focus more on the actual logic you are doing and practicing the concepts, so I'd say it's the way to go in the beginning.

yeah, but with python you are essentially learning a scripting language with a programming subset. 

 

Also, if you start with python, you will be handicapped. A friend made this mistake. He started with python. He became good at it. But when the time cam to learn C and C#, he was in actual physical pain.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, AnirbanG007 said:

C isn't a low level language. It's a high level language. Everything else, I perfectly agree with.

In today's world, C is the closest we have to a low level language. High level isn't C now my friend. It is Javascript and python.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, WolframaticAlpha said:

In today's world, C is the closest we have to a low level language. High level isn't C now my friend. It is Javascript and python.

I agree with you on an informal level, not on a technical level. 🙂 

Attention is what makes life meaningful.

Also, please quote me for a reply. 🙂

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, AnirbanG007 said:

I would advise you to start with C, or C++, definitely, as it is a statically typed language unlike Python and JS, and many things related to how computers perform are "hidden" from the user in Python. Python is great, no doubt, but seeing that you are a computer student, getting a leg up in learning about how a programming language interacts with a computer is essential. If you do this, and afterwards if you learn Python, you will understand a lot about why Python does this and that, and what it hides from the user to make it a simpler language. Not only will you gain much more knowledge by starting out with C/C++, but you will also grow an appreciation towards stuff like this when you understand the nitty-gritties.

 

For me, I started with QBasic, and then a bit of Java in high school, and then learned bits of C and Python parallelly, I definitely appreciate the insider knowledge that I have the now. And if I started with Python, learning C or C++ would seem harder just because I wouldn't have been accustomed to how computers and programming languages "really" work.

 

PS: if you start right away, within a month or so, you'd get a good understanding of the absolute basics of C/C++, that way it wouldn't hinder your progress in actually learning to code when you have other subjects to study along with it; like @trag1c said, it's pretty important to learn how to program, and is more important if you just need to know how to code and the nitty-gritties don't matter to you, or won't be useful in your curriculum.

Hey I mirrored your path!

 

I learnt qbasic from this guy: QBASIC Programming for Kids (tedfelix.com). Then I learnt java and then I did C and C++. After that I learnt Scala and I am loving it!

Link to comment
Share on other sites

Link to post
Share on other sites

13 minutes ago, OrangeSunshine said:

Which C variant one should learn first is an argument of its own.  I would argue it is important to learn C++ and then move to C and C# when necessary. At least, that is the path I am going down.

 

That being said, C and its variants are low level languages and are compiled. They are often considered a fastidious because of this, but offer lower level access to hardware and are typically faster. Python on the other hand is an interpreted language. As such, as long as python is installed on the computer you are using, your program should just work. Also, python handles a bunch of the tedium and lets you just work toward a goal. 

 

Ultimately, it just comes down to preference. If you are a person that really likes to dig in and get difficult things out of the way first (getting beat up every step of the way) go with C++. If you just want to be writing programs quickly to solve fun problems, then pick up a book like Python Crash Course by Eric Matthes, and you will have the core of the language down in a couple of weeks.

Start with C. Once you know C, C++ will come easily. C# is another thing. It has c in it just for the name. It is syntactically very different and you will be left scratching your head.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, WolframaticAlpha said:

Hey I mirrored your path!

 

I learnt qbasic from this guy: QBASIC Programming for Kids (tedfelix.com). Then I learnt java and then I did C and C++. After that I learnt Scala and I am loving it!

Glad to hear it. I'm currently training in Java, with for my upcoming IT job. Who knew!!!

Attention is what makes life meaningful.

Also, please quote me for a reply. 🙂

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, WolframaticAlpha said:

yeah, but with python you are essentially learning a scripting language with a programming subset.

Go ahead and explain the difference: how is programming using a scripting-language different from programming a compiled language, other than the steps that don't actually have anything to do with programming?

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

40 minutes ago, WereCatf said:

Go ahead and explain the difference: how is programming using a scripting-language different from programming a compiled language, other than the steps that don't actually have anything to do with programming?

simple.

 

compiled language is fast. It doesn't have a recursion limit and all those speed and flexibility goodies.

you can add microcode to your compiler.

 

also python is quite boring in my opinion. Too easy. It's just like html and whatnot. C and java and scala make me hot. Python doesn't have the same effect.

 

It is the same difference between python and a bash script/ windows script. And if you ask the difference b/w them, I will lose all respect for you.

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, WolframaticAlpha said:

compiled language is fast. It doesn't have a recursion limit and all those speed and flexibility goodies.

That's the "steps that don't actually have anything to do with programming" - part I mentioned; that's about running the code, not programming in and of itself, and thus irrelevant wrt. my question. Also, I take it that you didn't know that one can actually compile Python into static code and one can run e.g. C++ in an interactive JIT-compiler, also rendering your point moot.

 

One still has to learn all the concepts of code-design, control-loops, recursion and all that, regardless of how the code is actually run, and thus it's entirely fucking irrelevant whether the language is interpreted or not.

9 minutes ago, WolframaticAlpha said:

also python is quite boring in my opinion

Irrelevant. Your tastes have nothing to do with the difference between a "scripting-language" and a "non-scripting-language."

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, WereCatf said:

That's the "steps that don't actually have anything to do with programming" - part I mentioned; that's about running the code, not programming in and of itself, and thus irrelevant wrt. my question. Also, I take it that you didn't know that one can actually compile Python into static code and one can run e.g. C++ in an interactive JIT-compiler, also rendering your point moot.

 

One still has to learn all the concepts of code-design, control-loops, recursion and all that, regardless of how the code is actually run, and thus it's entirely fucking irrelevant whether the language is interpreted or not.

Irrelevant. Your tastes have nothing to do with the difference between a "scripting-language" and a "non-scripting-language."

"Steps that don't have to do with programming"

 

If everything was to do with making the devs life easier then everyone would be a soydev and game engines would be written in html and python.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, WolframaticAlpha said:

If everything was to do with making the devs life easier then everyone would be a soydev and game engines would be written in html and python.

HTML is a markup-language, not a programming-language......

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, WereCatf said:

HTML is a markup-language, not a programming-language......

I meant the HTML troika html+css+js and angular+node+react or whatever frameworks you want.

Also python is a scripting language. But you can create beautiful programs in it. You can also create beautiful web apps using the stuff I mentioned above

Link to comment
Share on other sites

Link to post
Share on other sites

C++ because knowing computer engineering, you will be writing C code eventually. Computer engineering is half electrical engineering. They usually code in assembly or C. Object oriented paradigm of C++ is a plus because nearly all application level softwares follows object oriented paradigms these days. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

15 hours ago, WolframaticAlpha said:

"Steps that don't have to do with programming"

 

If everything was to do with making the devs life easier then everyone would be a soydev and game engines would be written in html and python.

Depends on what you wanna do. For creating user applications sure, higher language like python/java is easier but low level stuffs like executing a syscall(calls to the operating system kernel), forking(spung child processes, a proccess is like a thread but has its own heap and execution stack) and ioctl(input/output operations on a device) are much easier in C.

 

Imagine doing a fork in java. I don't even know if that is possible. 

 

Also for the stickler out there, a python script isn't a program per se. A java executable jar or class files are not programs either. They are simply files. They do not execute natively by the computer and operating system/kernel. 

 

Java virtual machine is a true program because it is an executable binary. It can be executed natively by your operating system.  This is a program that runs your java "program" if you will.

 

For compiled languages like C/C++, your source code in text files are compile into binaries of 0 and 1s(machine codes) which can be executed by your operating system directly. OS kernel will load these executables into memory and then execute them as a running proccess. You do not need to have compilers and whatnots to run these. I kinda think javascript in web browser the same way. They aren't programs that are executed by your computers. Browser is the actual program and it is executing your js code in its webpages. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Sakuriru said:

Don't worry about it they'll teach you.

 

But you'll probably end up doing C.

 

Yes they do.

well then,, I haven't hit it

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, WolframaticAlpha said:

well then,, I haven't hit it

The complier probably convert the recursion into loops as part of the optimization. In such cases, you won't have infinite recursion. You have never ending loop. 

 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Sakuriru said:

It depends on how much memory was allocated to the stack during the program's start.

oh, right. I just put it to test. Hit it. Allocated the same amount of memory as consumed by the python program. Superlatively more efficient.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, wasab said:

The complier probably convert the recursion into loops as part of the optimization. In such cases, you won't have infinite recursion. You have never ending loop. 

 

yeah. I retried and this time ran an explicit recursion. C was, as expected, much faster.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×