Coding in Python 04 - Setting up Variables

From LearnLinux.tv Wiki
Jump to navigationJump to search

Overview

In video 4, variables are introduced.

Relevant Links
Original Video


Commands Used in this Video

Creating a variable containing a string

my_var = "Hello World"
print(my_var)

Creating a variable containing an integer

my_var = 2
print(my_var)

Print the type of a variable

type(my_var)

Concatenating string variables

my_var_1 = "learn "
my_var_2 = "python"
print(my_var_1 + my_var_2)

Adding integer variables

var1 = 10
var2 = 56
var1 + var2