The Differences Between C# & Python

preview_player
Показать описание
C# & Python are both great languages! But what makes them different?

Please follow me on social networks:

REMEMBER TO ALWAYS FEED YOUR CURIOSITY
Рекомендации по теме
Комментарии
Автор

At 1:50, you should say you *declare* the type, not "cast" it. Typecasting is something else.

marian
Автор

For me...
Python: is good for learning coding as a beginner
C#: good for actually coding

Phoenix-ipkg
Автор

You can use "var" in C# to avoid explicitly declaring the type.
Also, you can use "dynamic" for variables that change type.

Waffle
Автор

Python is my favourite language rn, I just don't like how when I accidentally add an extra space everything stops working and it's usually difficult to find

TammonOG
Автор

Bear in mind that specifying the type of the variable in C# exists for a reason. It's there so that both the compiler and the code writer understand a variable is being declared and used. This comes in handy for catching bugs as a typo will cause your code to not compile. As opposed to Python, a typo will simply create a new variable and you'll have a logic error (typically harder to debug) instead of a compile time error. I'm writing my own scripting language and ended up switching from Python to C# style for this very reason.


As a quick aside, in C#, you don't need to always specify the type when declaring a variable. If you are declaring and initializing, you can use `var` and the type of the variable will become the type of the expression.


I'm excited to learn Python because of how terse it is, but honestly it represents a lot of the things I've been trying to run away from: non-strict variable declaration, dynamic type systems and a focus on mutability. After over a decade of experience, I find these things to be more of a hindrance than a benefit especially as your code base grows.

djpeterson
Автор

These 2 are my favorite programming languages, but I have to say, I think C# is the 'better' one. Yes, I know they are different and they are used differently (e.g. Python is more used by data scientists while C# is more popular in a business environment) - but I think C# is more modern and advanced. I will give just 1 example to prove this - Linq. While Python has list comprehensions and lambdas, and they certainly are powerful, they are nowhere as elegant and convenient as Linq. All that said, I do like both languages a lot, but have a slight preference for C#.

zeppelin
Автор

First off: big fan; but there are some mistakes:
The types are declared not cast

Python doesn't need to declare variable types but not because it's Interpreted but because of it's type system which is dynamically & implicitly typed (while still being strongly typed I think?); Whereas C# usually is statically, weakly and explicitly typed (with Support for dynamic typing and type inference(recommended by MS))

If there are errors in this please correct me :D

SVVV
Автор

I'm not an expert and also no native speaker, nor very informed with the general programming terminology, so if there's anything you think is wrong, feel free to correct me. In fact I don't know most of the stuff but am making educational guesses instead based on how the discussed points in this video make sense to me.

In C#, the reason why you have to give a variable a type and can't change its value to a value of another type is not necessarily bad (and not there because the language can't figure it out by itself, in fact there are ways it can which I will point out later) but rather a design choice. When declaring a variable as one type it barely ever makes sense to give it later on a value of another since one variable should always represent one specific "idea". And almost all of the time that one won't change its type since it's bound to it.
If you want C# to figure out the type by itself you can just always use the "var" keyword which will make the variable of the type of the value that you're assigning it to. The only times you can't do that, as far as I know, are when you're just declaring a variable but not initializing it, or you're giving a non-struct object it's default value "null" since that could be valid for any reference type and couldn't be figured out just by the value a variable is being assigned to.
If you want to use a dynamic type meaning it can change its value type afterwards, even though that has very limited practical uses with the main disadvantage being that the compiler has no clue on what type it is and therefore what fields, properties and functions it contains, just use the keyword "dynamic".

That being said, I absolutely do love python for its syntax of not having to resort to semicolons and espacially curly braces. Since you want to format your code to be readable anyways, in my opinion it absolutely makes sense to merge the syntax and indentation into one to avoid much visual noise.

FurryDanOriginal
Автор

nice video. Personally I prefer C#, it is strongly-typed meaning far easier to find errors while you are writing the code. With Python runtime errors are a nightmare

Imperial_Dynamics
Автор

these are the exact two languages I want to learn, how exciting

ThatGuyDownInThe
Автор

i really love how he makes his videos like the "SYNTAX" part. Although it is simple for many, I'd like to learn how he does his videos.

znchrzr
Автор

I think c# is a lot easier since I get less bugs than python

pylewastaken
Автор

5:25 you can use the datatype: var -> variable, in c++ it is auto.

stonefreak
Автор

If your thinking which one to learn, take a minute to reflect on what you want to do with code. Wanna make games? C#. Wanna make bots? Python. They are good for different things. If you have enough time, then try to learn both. Learning another language usually cant hurt :)

talwat
Автор

Yeah Umm having loosely typed variables can be a HUGE problem when it comes to introducing bugs into your program while also introducing hard to debug errors and unwanted behaviors! It's like we haven't learned anything in these last 30+ years! It's like Javascript in a way!

Thanks, but I'll stick with the easily debuggable, maintainable, and predictable behavior code of C#!!

thefront
Автор

For big projects I choose c# every single the day.
C# makes the code consistent and give you more control The chance to build stable secure apps is bigger. Python in the other hand has more focus on the business logic o ('human logic') Wich is great when you are dealing with data science you don't want to mess with data types you write spaghetti code that just work you don't need the same control, but if you work with huge projects this can easy get annoying and hard to work so I only use python where I need fast development without the need of that kind of code control.

wilmararias
Автор

Great tutorial. I'd love this to be a whole series. Learning python and c# at the same time.

foxrumor
Автор

Dude! Wow! A sincere print('thank you!') for doing this!
My motivation is back on track!

IgorDz
Автор

Really thought you did a great job outlining the syntax. Plus seeing the side by side comparison drives the point home nicely.

SecurityCraftsman
Автор

6:42 "seam eye colon" that is great ;)

KEMBL
welcome to shbcf.ru