Introduction to Python

Everyone wants to code but it’s neither that simple nor too hard to learn .

Everyones reaction after learning from LibPy

So let’s start with something Interesting now .

Basic Terminologies

String : A string is a sequence of characters. A string in Python is immutable and is written within single or double-quotes.

Variable : A variable in Python is a named memory location that stores a value.

Comments : Comments can be used to explain Python code , used to make the code more readable and used to prevent execution when testing code. # is used before writing anything in comments

Creating First Program

# method 1 (printing any information as output)

print("hello world") # these values are called strings (anything inside a "" is a string in python)
print(1) # these values are integers 
print(1.5) # these values are called float 
print(1,5) # prints values in a single line when seperated by a comma

Storing Strings inside a Variable

num_1 = 1 # num_1 is called a variable where any data is stored 
str_1 = "tony stark" #str_1 is called a variable

print(num_1)
print(str_1)

Checking data types

# checking data types
# a function is used called type()

d_check = type(str_1 ) # the type function checks every value data type
print(d_check)

print(type(num_1))
print(type(1.5)) 

Free Python practice Lab

Leave a Reply

Create your own website, free on WordPress.com.Create your own website.
Start free