Is it worth learning C/C++ before learning Python? [closed] - c++

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 months ago.
Improve this question
I want to learn python, but I feel I should learn C or C++ to get a solid base to build on. I already know some C/C++ as well as other programming languages, which does help. So, should I master C/C++ first?

In my opinion it's better to start learning Python.
I found it easier to learn then C or C++. It has libraries to do virtually anything you might need, and can do essentially anything.
The only reason to use a more difficult language like C/C++ is if you need the performance or are writing code for an embedded system. They are not, however, what you should be learning initially.
C# is a fine language, but nothing beats Python for ease of use.
The scope of Python is quite broad, here are some examples:
Create a website (Django, etc.)
Create scripts to do tasks ranging from image manipulation to server maintenance
Create GUIs (Tkinter, etc.)
Create games (pygame)
Scientific computing (SciPy)
Python can interact directly with arbitrary C code, meaning anything which can be done in C, can be done in Python with a little work. Python is popular enough that an interface has been created for virtually everything already.
For a better look at what can be done with python out of the box, take a look at the standard library which comes with python: http://docs.python.org/library/
In short, if it can be done with a computer, and doesn't require the speed of C/C++, it can be done with Python.

I would say it depends on what you want to achieve (cheesy answer...)
The truth is, learning language is a long process. If you plan on learning a language as a step toward learning another language, you're probably wasting your time.
It takes a good year to be proficient with C++, and that is with basic knowledge of algorithms and object concepts. And I only mean proficient, meaning you can get things done, but certainly not expert or anything.
So the real question is, do you want to spend a year learning C++ before beginning to learn Python ?
If the ultimate goal is to program in Python... it doesn't seem worth it.

Real mastery of a language takes time and lots of practice .. its analogous to learning a natural language like French . you have to do a lot of practice in it. but then different languages teach you different programming methodologies.
python and c++ are all object oriented languages so you will be learning the same programming methodology
The order in which you learn languages doesn't really matter but starting from a lower abstraction to higher one makes understanding some things easier..

In my opinion you should defiantly learn Python before attempting to learn C or C++ as you will get a better understanding of the core concepts, C++ is mush lower level than Python so you will need to make more commands to do something that you can do in one line in python.

Related

How to start Machine Learning with python programming? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I know the concepts of python programming. And I heard that with python machine learning is more compatible. So, I want to start the machine learning using python. I am a novice in machine learning.(just want to start from scratch)
How will I start towards this??
You will need to learn theoretical sutff including maths/stats/data mining etc...
The best way is - depending on ur current background - probably the very famous Andrew Ng Coursera Course on Machine Learning. I honnestly don't think there's a faster/easier way. Youtube may be a good help as I already found tons on ML/stats related videos.
Having solid knowledge on statistical background of machine learning, I think is more essential. Numpy, pandas, matplotlib, scikit-learn, would be some useful tools in python for machine learning.
One of the best resources I found when I first started using Python for machine learning was Sebastian Raschka's Python's Machine Learning book.
I also used a variety of different Udemy tutorials, such as this one. They're great for building confidence, but they generally only show you generic use cases, with data sets that are typically much cleaner than the ones you'll see in real life.
However, make sure that you are understanding the conceptual basis of what you are doing. Anyone can go import scikitlearn and crank out some predictions, but what separates an amateur from a professional in this being able to write your own custom algorithms, understanding the edge cases, and lower-level nuances (ie. when to use L1 vs. L2 regularization, or whether your data pattern means you can implement a RBK vs linear support vector machine), etc. For that, I'd highly recommend picking up a few machine learning and predictive analytics textbooks, such as Applied Predictive Modeling by Max Kuhn and Kjell Johnson.
Finally, there are a variety of great podcasts to listen. One pretty accessible one for beginners to familiarize yourself with core data science principles is the The Data Skeptic.

implementing neural networks using c vs using c++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm imlementing Neural Networks using C language for a class. I haven't programmed with C++ nor with C for a long time. I started my first couple implementations using C language and it was a pain in the neck!
Now, I am not sure is it because of the language or its how NN is with any language??
BTW, we are not allowed to use any NN toolbox or libraries.
Some people told me its much easier to do it in C++. But I am in a very tight schedule and I'm afraid I might waste "valuable" time transitioning to C++ to find out the benefit is marginal!
So I thought you might guide me into this? Will it be worth it (time efficiency wise) to switch to C++ or not?
Thanks
Just like any other programming task (that doesn't rely on some framework which is only available in 1 language), there is no magical advantage gained by using a special language for Neural Networks.
If you agree that writing code in C++ in general is much easier than writing code in C, then writing Neural Networks code in C++ is much easier than writing Neural Networks code in C. But that is a highly opinion based topic.
Transitioning to C++ could be worth your time, especially if you've already developed some Object Oriented skills and understanding (even if not with the C++ language itself). However if OO is difficult for you, then the transition may cause more harm than good. It depends on you as a programmer.
The transition won't be as hard as you think. In my opinion, it's less like learning a new language altogether, but instead more like learning new features to a language. Keep in mind that all C code you write will still compile in C++ (mostly, I think? See Kitsune's comment on this answer) because C++ is almost a superset of C.
There's no... direct benefit, so to speak. You can still solve the problem in C, but C++ and Object Orientation may help you create a better, more sharable and understandable solution as although I don't know so much about Nueral Networks, I'm pretty sure some of the characteristics can be neatly abstracted thanks to Object Orientation.
Then again, if OO isn't your peice of cake, then this may end up making it even harder for you. Consider your strengths as a programmer: could you draw a class diagram to figure out how everything fits together comfortably? Do you have a good understanding and appreciation of OO concepts like interfacing and abstraction? If not, then OO could do more harm than good.

Should I use a code converter (Python to C++)? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 months ago.
Improve this question
Let me just say right off the bat that i'm not a programmer. I'm just a guy with an idea taking his first steps to make it a reality. I'm no stranger to programming, mind you, but some of the concepts and terminology here are way over my head; so i apologize in advance if this question was answered before (i.e. Convert Python program to C/C++ code?).
I have an idea to create a simple A.I. network to analyze music data sent from a phone via cloud computing (I got a guy for the cloud stuff). It will require a lot of memory and need to be fast for the hard number-crunching. I had planned on doing it in python, but have since learned that might not be such a good idea (Is Python faster and lighter than C++?).
Since python is really the only gun i have in my holster, i was thinking of using a python-to-C++-converter. But nothing comes without a price:
Is this an advantageous way to keep my code fast?
What's the give-and-take for using a converter?
Am i missing anything? I'm still new to this so i'm not even sure what questions to ask.
Thanks in advance.
Generally it's an awful way to write code, and does not guarantee that it will be any faster. Things which are simple and fast in one language can be complex and slow in another. You're better off either learning how to write fast Python code or learning C++ directly than fighting with a translator and figuring out how to make the generated code run acceptably.
If you want C++, use C++. Note, however that PyPy have a bunch of benchmarks showing that they can be much faster than C; and with NumPy, which uses compiled extensions, numerical work becomes much faster and easier.
If you want to programme in something statically compiled, and a bit like Python, there's RPython.
Finally, you can do what NumPy does: use extensions written in C or C++ for most of your heavy computational lifting, where that appears to be appropriate, either because profiling shows a hotspot, or because you need an extension to more easily do something involving python's internals. Note that this will tie your code to a particular implementation.
Similar to what was already stated, C++ may be faster in some areas and slower in others. Python is exactly the same. In the end, any language will be converted into machine code. It is really up to the compiler in the end to make it as efficient as it knows how to do. That said, it is better to pick one language and learn how to write fast and efficient code to do what you want.
No because significant part of the good C++ performance comes from the possibility to choose the better performing architecture. It does not come magically from the same fact "because it is C".
A simple, line by line translation from Python into C++ is unlikely to increase the performance more than just using something like Cython so I think it is more reasonable to use Cython. It can still be much worse than a good developer can do with C++ from scratch. C++ simply provides more control over everything like possibility to define data type of the minimal needed length, fixed size array on stack, turn off array bounds checking in production and the like.

Start with some C++ framework or python [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I am thinking about to learn new language or framework. Now I deal with C# and WPF, WCF, Winforms. I have some free time so I would like get new skills.
But I have dilema, start with some C++ framework (such as Platinum, Reason, Evocosm, ACF)
or try Python / python framework.
I you are on my place which possibility you choose?
I am 17 years student, I have basic skills in C++ (OOP, little with STL), with Python I haven’t any experience.
What would be your choice and why?
Python is incredibly easy to learn, very powerful, and very useful (especially for web development IMO).
C++ is very widespread and is similar to other languages like C# and Java. Python's syntax is quite unique and AFAIK is not very similar to any other languages. Nonetheless, Python syntax is far easier to read and cleaner to write than C++.
Python is also fairly widespread and is used by huge companies like Google.
C++ has some wonderful libraries that can really help development, like Boost and Qt. Python also has excellent libraries like Django (for web development) and Twisted (for networking stuff). I find that C++ libraries tend to be broader in scope than Python libraries do, but the Python standard library is far better than the STL, IMO.
Python recently had a backwards-incompatible release (Python 3), and most libraries haven't caught up yet, so you might have to use Python 2 to take advantage of some of Python's libraries.
C++ is a lot faster than Python in terms of execution speed, but Python more than makes up for it in terms of development speed. Plus, Python allows you to write performance-critical parts of your application in C or C++.
Overall, I'd say go with Python, mostly because it's easy to learn and use, and makes programming simple and fun.
I recommend you to keep learning C++. Before you started looking for framework learn some popular search algorithm and try implement them. After that try implement some structures, like queues, list, stack, binary trees and some operation on them. Meanwhile play with I/O (for example, try write your stack to file and read it back to stack - in plain text and binary).
It was my university tour on programming class. C++ is good choice because it is hard and multiparadigmats language so in future u will find much in common with other languages and you will be familiar with memory management system.
Personally I prefer Python, but profesionally, that is if you want a good job C++ is a better choice.
I'd pick C++ for the sole reason that it's nothing like the languages you already know, even though it shares some syntax.
I strongly recommend you at least learn a bit of Python first, even if you decide stay in C++.
One may say C++ is the most powerful program language.
However, for a starter, there are too many traps and pitfalls.
In your situation, Python is something that can let you know more about programming.
Since you have no experience in Python, It's very easy to learn at the beginning.
And it will show its effect very quickly.
Plus, learning it will help you understand C++ more, like STL and Boost, they all have similarities with Python. Qt even has PyQt as a Python bindings. They have the same API, while the syntax in Python is clean and elegant.
Here is a remarkable tutorial for Python: http://diveintopython3.org/
I suggest you just try it a bit, it wouldn't hurt.
Well. Learning Python basics will take a week, and you will save the time spent in a year since it is such a good language for small hacks and scripts. So I suggest you learn it first.
Learning C++ well will take you five to ten years, so there is not the same immediate benefit :)

Absolute beginning in programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have worked for the last 10 years in Networking & Web Development and always had an interest in programming. When I was in School I started in Basic, (To date myself) the other languages at that time were Cobol & Fortran, Where should I start in 2009? is C+ or C++ a good place? Is it better to Start Java or .net? I'm in need of some direction from Coders, Programmers, developers who can point me in the right direction. The technology changes in the blink of an eye, I'd like a good starting point to begin learning & understanding relevant code.
I think your best bet is to learn Python because
It is simple and easy language to learn
Python is capable of doing what any other main stream language can do
Python is also a very good choice for web development, with good frameworks like Django, Pylons, Turbogears etc
Google uses Python and using google appengine you could be able to quickly write web applications.
Python is also great for cross-platform desktop applications using wxPython, PyQT, Tkinter,gtk etc
Python has very rich set of libraries and frameworks e.g. PIL for imaging, numpy for computing, twisted for networking etc etc etc
Python has implementation in Java and .NET so you can program for those platforms in Python
I agree with most of the posts on here but I would like to add my own slant on this. Learning a programming language should change the way you think about programming and allow you to make useful programs. The list below is a mix of easy to learn (the basics) and helps you think about programming problems
Python it makes programming fun and easy. You will learn a lot about programming and make some cool programs in a relatively small amount of code. Will help you think about programs at a higher level than C which is a good thing.
C it's the basis of a massive number of languages and will teach you a good deal of stuff that is now considered low level. Stuff that will be useful for any programmer to know.
Haskell its a functional language which will have you thinking about programming from a different perspective. It is very useful to know this stuff - can help reduce many bugs.
I would start by gaining a basic knowledge. i.e. be able to make a text based Connect 4 game in each of these three languages (in order). Which books help you do that is largely personal preference.
Programming is not only about the code and the language. It's about everything you do at the computer read The Pragmatic Programmer and Code Complete 2. Extra points for SICP and Hacker's Delight
From there if you want to know more about how programming languages work by writing a interpreter for Scheme (by reading SICP again) And/or look at FORTH. Or learn more about how to program by writing more and more programs. Once you get basic knowledge write, then re-write as many different computer programs as you can.
It all depends on your focus.
If you're looking at getting into straight development, I would recommend C#, Java or C++. (C++ is a learning curve though, and would be great to "learn", whereas C# and Java will get you started a lot quicker in doing "cool" things)
If you're looking at Web Development, look into PHP (as it's free to setup and run with) or ASP.NET (which will link to platform at a point, as you use C# or VB.NET syntax).
If you're looking at something different, have a look at ERLANG or Prolog, or those types, however I don't recommend it for a start, as it's not AS quick to get results that you might be looking for.
You'll get a dozen different people all pushing you to learn their favourite language.
When it comes down to it though it doesn't make a lot of difference. As long as you pick something that is modern and object oriented you should be fine.
Assuming you are talking about programming and not web development, any of the following would be a perfectly acceptable first language:
C#
Java
Python
C++
Ruby
VB.net (not VB6)
There are advantages and disadvantages to each; there probably aren't as many jobs in Python and Ruby, C++ is harder for a beginner, but it's stuff you need to know eventually, C#/Java hide you from that hard stuff to begin with, but like I said you'll need to learn it eventually. VB.net is derived from BASIC syntax so you might feel at home to begin with, but a lot of programmers prefer C style syntax.
If you have a specific focus in mind, then that might dictate some choices over others, but if you are just out to learn programming, then any will do. If you are ever planning on being a good programmer you will naturally learn several.
Well, technically, technology doesn't change in the blink of an eye. For instance:
Lisp: Came out in 1958. It's always had a cult following in various fields, but it's becoming more hip now with the clojure variant.
C: Came out in 1972. Obviously influences C++, Java, JavaScript (as does lisp), and still has a strong following.
Smalltalk: Came out in the 70's. Now it's hip via the ruby language.
I'm not suggesting you learn these, just that if you had learned them in the past, you'd still have relevant skills. Many of the modern languages actually take aspects from past languages. JavaScript, for instance, is a scripting language with object oriented aspects (Smalltalk, C++), functional aspects (lisp), and the syntax of C.
Learn what you're interested in, and find out what will help you accomplish your goals . But learn one and you can learn many.
The question is what you want to achieve in learning a programming language.
Do you want to get used to the basics? Then you might want to try a scripting language like Ruby or PHP. I would recommend Ruby as it's really easy to learn and advance (e.g. with IRB).
Want to write "fat" (desktop) applications? Then you should stick to C++, Java or C#.
For web applications you should use Ruby on Rails, Django (Python) or a similar web framework for the language of your choice. So you should already know a bit of the language.
C
Because it's not difficult to learn. TO LEARN, not to do "cool things".
Because is the languague that any good programmer SHOULD KNOW at least if he wants to know what's happening in the machine.
When you've learned C, then you should go to OOP: I would recommend C++ or Java, but there are a lot of OPP languages (C#, .Net), so you can choose.
Java, C++ may change a lot, but not C. So, first learn C.
Furthermore, if you want to do some Web Development, the step C -> PHP is trivial, really.
PD: C is not my favourite language, but I know that if you learn C, you will be able to learn any language you want in very few time.
Nobody can really tell you which language you should learn. Just try a few of them and then decide for yourself. Just take the one that you like the most.
Of course I wouldn't start learning a language that's already "dead", but every modern language is good for something. What you should actually do is to decide in which area of programming you want to code - so, for example, would you like to develop desktop or web applications, should the program run on any platform or are you fine with just windows or just linux or whatever. When you have decided on that, take a look at the languages that are commonly used for the area you choose and try all/many of them. Then take the language you like the most.
Read and do the assignments in The C Programming Language before anything else. It will really help you get a solid grip on fundamentals and some of the trickier issues like memory management. Then go on to OOP whether it be Java, .NET, C++ or Python.
If you start in C you'll have a tougher time starting out but will learn a lot more by the time you understand the language as compared to starting with another language. C won't teach you Object-Oriented Programming though, so after C it would be easy to move to C++ and learn the differences and then about Objects. A good book to learn C from is The C Programming Language.
Or you could go a route where you start off easier so things aren't so frustrating to start, learn a bit less, and then slowly pick up more and more about programming. You could start with Python and understand the basics of programming very quickly, and then start expanding what you know by learning other languages.
I personally started with C++, which then made a lot of other higher level languages, like Python, super easy to learn. If you want to start out learning more of the basics of programming I would probably recommend C++ first as it is a bit easier than C, and then you can learn C afterwards and it will be a bit easier, and then it'll be super easy to pick up something like Python, Java, Ruby, etc.
I think choosing a language or technology is overrated, especially when you have to learn fundamental things like object orientation or algorithms. Try to focus on the basics first and especially try to use more than one language.
In order to understand the concepts you should at least learn a dynamic language (Ruby, Python, PHP) and a "traditional" one (I would recommend either Java or C#). Functional languages are all at rage now and provide a different view onto programming than the latter two approaches.
New technologies are always nice to know, but in the end a good set of fundamental knowledge will empower you to learn them faster than they disappear.
I would say there is a massive difference between a Programming language & a Programming Language + Framework(s), usually when people say Learn Language X they are probably thinking about the Framework(s).
So if you want to actually Learn to program, try to learn the language with as little framework 'baggage' as possible, perhaps C?
Once you have gained enough working knowledge of a programming language (eg variables, loops, conditions) then move onto more broader subjects like OOP, then start looking at functional style etc.
From personnel experience I would say try and learn as many programming languages as possible (it actually gets easier the more you learn) but you will never master them all, just have enough to get by.
You will then realise that the language is the easy part, the framework and related methodology is what your actually learning when going from one language to another.
Much as I love Delphi, I think I would suggest either Java or Python. Why? Assuming you are learning on your own, I think these languages have the clearest texts and web sites for learning on your own (esp. Java).
Seeing that you're coming from two different fields (networking and web development) you can either work your way top down or bottom up in terms of high- or low level languages. If you think you want to make use of your networking knowledge (which I assume is pretty close to hardware), you might want to start with something like C, maybe Unix network programming. If you want to build on your web developer skills, you might want to try something more high level. I think Python is a good suggestion, but also Java - maybe in combination with JSP. C# would be a good choice too in my eyes.
Don't forget about platform. Are you most interested in web, mobile, or desktop development? As for languages, there are a ton out there and you'll never be able to learn them all. So I think you should determine what your goal is and whether you plan to program for fun, profit, or both. But most important of all, be sure the journey is fun for you and that you're building stuff you love.
A good reason to learn Java - besides the fact it's currently the most popular language - is that the Java Trails tutorials are really good, and really far-reaching.
C# is very, very similar to Java in most regards; also interesting to learn, and it's gaining marketshare while Java slows down.
Other than those two, I'd also strongly consider Python, for being easy to learn and very, very useful personally and professionally.