Sitemap
Case Robertson

Case Robertson

Geospatial Data affects us all and soon Blockchain Tech will too. How may I assist you?

Member-only story

The Basics of Python

4 min readMar 24, 2023
Hello World :)

Python is a popular programming language that is easy to learn and use, making it a great choice for beginners. In this article, we’ll go through some basic code examples to get you started on your journey of learning Python.

  1. Printing “Hello World”

The first program any beginner should learn to write is the “Hello World” program. This program simply prints the phrase “Hello World” to the console. Here’s how to write it in Python:

print("Hello World")

2. Variables and Data Types

Variables are used to store values in a program. Python supports various data types, including integers, floating-point numbers, strings, and booleans. Here’s an example of how to create a variable in Python:

my_variable = 10
my_float_variable = 3.14
my_string_variable = "Hello"
my_bool_variable = True

3. Basic Arithmetic

Python supports basic arithmetic operations, including addition, subtraction, multiplication, division, and exponentiation. Here’s an example of how to use these operators:

num1 = 10
num2 = 5
sum = num1 + num2
difference = num1 - num2
product = num1 * num2
quotient = num1 / num2
power = num1 ** num2

print("Sum:", sum)
print("Difference:", difference)
print("Product:", product)
print("Quotient:", quotient)…

--

--

Case Robertson
Case Robertson

Written by Case Robertson

Geospatial Data affects us all and soon Blockchain Tech will too. How may I assist you?