Hello, future coders! ๐ Are you ready to delve into the magical world of Python programming? ๐ฉ๐ฐ Python ๐ is a beginner-friendly programming language that is used by beginners and pros alike, everywhere from scientific computing and web development to machine learning, AI, and beyond!
So, let's start your coding journey, and don't worry, we'll go step by step. ๐ถโโ๏ธ๐ถโโ๏ธ Buckle up! ๐
Why Python? ๐ค
Python stands out among other programming languages dueto its simplicity and readability. It makes the coder's life easier by eliminating the need for complicated syntax and boilerplate code. In simple terms, Python is like the friend who tells you, "Relax! Let's keep things simple!" ๐โ๏ธ
What is Python? ๐คจ
Python is a Open source, general purpose, high level, and object-oriented programming language. It was created by Guido van Rossum. Python consists of vast libraries and various frameworks like Django,Tensorflow, Flask, Pandas, Keras etc.
Setting Up Python ๐ฉโ๐ป๐จโ๐ป
First things first! We need Python installed on our machine. Here is a ๐link to download Python directly from their official website. Choose the version that best fits your system, install, and we're ready to roll!
Python IDEs ๐ฅ๏ธ
An Integrated Development Environment (IDE) makes coding much smoother. Some popular Python IDEs are PyCharm, Jupyter Notebooks, or even simpler editors like Sublime Text and Atom. Choose your weapon of choice, and let's start coding! ๐ฏ๐ป
How to Install Python? ๐ฑโ๐ป
You can install Python in your System whether it is window, MacOS, ubuntu, centos etc. Below are the links for the installation:
Install Python on Windows
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.11
python --version
Python Data Types ๐
In Python, we have several types of data:
- Numeric : You can use integers, floating-point numbers, and complex numbers. โ
integer = 10
print(integer, 'is of type', type(integer))
floating_point = 20.5
print(floating_point, 'is of type', type(floating_point))
complex_num = 1j
print(complex_num, 'is of type', type(complex_num))
Dictionaries: Dictionaries are used to store data in key:value pairs. ๐
dictionary = {"name": "Python", "age": 30}
Booleans: These represent one of two values: True or False. โ๏ธโ
boolean_1 = True boolean_2 = False
Set
The Set is an unordered collection of unique items. Set is defined by values separated by commas inside braces { }.
#Create a set named Student ID student_id = {111, 115, 113, 114, 110, 116, 117} #Display elements of it print(student_id) #Display Type of Student ID print(type(student_id))
Sequences
Strings: These are sequences of character data. Enclose them in single or double quotes. ๐
string_1 = 'Hello, World!' print(string_1)
Lists: These are collections of items (strings, integers, or even other lists). ๐
list = ['apple', 'banana', 'cherry'] print(list[0]) print(list[2])
Tuple: Tuple is an ordered sequence of items same as a list. The only difference is that tuples are immutable. Tuples once created cannot be modified.
We use the parentheses () to store items of a tuple.
#Create a Tuple product = ('Microsoft' , 'Linux-Ubuntu' , 'other') #Access Element at Numbber1 print(product[0]) #It will print Microsoft print(product[1]) #It will print Linux-Ubuntu
Basic Operations in Python ๐งฎ
Python supports all the mathematical operations you would expect:
Addition (
+
)Subtraction (
-
)Multiplication (
*
)Division (
/
)Modulus (
%
)
# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
# Add two numbers
addition = float(num1) + float(num2)
print(addition)
subtraction = float(num1) - float(num2)
print(subtraction)
Remember, Python is a powerful language but also very friendly to beginners. Start slow, practice daily, and soon you'll be doing incredible things with it! ๐
So, keep calm and code Python! ๐๐ฉโ๐ป๐จโ๐ป
Do remember, every programmer was once a beginner. ๐ก Keep your enthusiasm alive and never stop learning.