Enough Talk, Let's Get Coding


https://youtu.be/T4tZSbqRd-8

Python, unlike Java, C++, and many other languages, has very little code overhead. Everything you learn can be immediately used in code. For instance, pop over to https://repl.it/languages/python3 and type the following classic line of code:

print("Hello, World!")

As you would suspect, it outputs simply:

Hello, World!

There's no input and not really any processing here - just output: the computer giving data to the user.

You can also print numbers:

print(10)

print(3.14)

and math expressions:

print(5 + 5)

prints 10 as expected.

HOWEVER,

print(5.0+5.0)

prints 10.0 ... What's up with that?

The short answer: 5 is an integer, 5.0 is a floating point. They have different Type.

Next Post: Mysterious Printing Type Errors

Recent Posts
Tags

© 2019 BrainStemSchool.com