Search Bar

Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Friday, 26 May 2023

"Python Programming" Tut#09 | "If-else", "elif" statements

Python Tutorial 09

If-else statement

In Python, the if-else statement is used to perform different actions based on a certain condition. It allows you to execute a block of code if a condition is true, and another block of code if the condition is false.

The general syntax of the if-else statement in Python is as follows:

Sunday, 21 May 2023

Python Programming Tut#08 | List, Tuple, Dictionary

Python Tutorial 08

Lists in Python

In Python, a list is a built-in data structure that allows you to store a collection of items. It is an ordered and mutable (changeable) sequence. Each item in a list is called an element and can be of any data type, including numbers, strings, or even other lists. Lists are created using square brackets [ ] and commas , to separate the elements.

Here's an example that demonstrates various operations with lists:

Python Programming Tutorial 08 | List, Tuple, Dictionary
Python Programming Tutorial 08 | List, Tuple, Dictionary

Saturday, 20 May 2023

Python Proramming Tut#07 | Python Operators

Python Tutorial 07

Python Operators

In Python, operators are special symbols or characters that are used to perform operations on variables, values, or expressions. Python provides a wide range of operators that serve different purposes. Here are the main categories of operators in Python:

Arithmetic Operators: 

Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, division, modulus, and exponentiation.

Addition: '+'

Subtraction: '-'

Multiplication: '*'

Division: '/'

Modulus (remainder): '%'

Exponentiation: '**'

Floor Division (quotient): '//'

Saturday, 6 May 2023

Python Programming Tut#06|Data Types

Python Tutorial 06

Data Types in Python

Python is a dynamically-typed programming language, which means that you do not need to explicitly declare the data type of a variable before using it. The data type of a variable is determined automatically based on the value assigned to it.

However, Python has several built-in data types that you can use, including:

Numbers: int (integer), float (floating-point number), and complex (complex number).

Strings: a sequence of characters enclosed in quotation marks.

Boolean: a data type that can have one of two values: True or False.

Lists: an ordered collection of items, which can be of any data type.

Tuples: similar to lists, but immutable (cannot be changed).

Sets: an unordered collection of unique items.

Dictionaries: a collection of key-value pairs, where each key is associated with a value.

Here's an example of how to create variables of different data types in Python:

Sunday, 30 April 2023

Python Programming Tut#05|Variables in Python

 Python Tutorial 05

Variables in Python

In Python, a variable is a container that stores a value, which can be a number, a string, a boolean, lists, tuples, dictionaries or any other data type. You can assign a value to a variable using the equal sign (=).

For example:

x = "Hello, World!"

In this example, x is the name of the variable, and "Hello, World!" is the value that it stores.

Saturday, 29 April 2023

Python Progrmming Tut#04|Comments in Python

Python Tutorial 04

Comments in Python

In Python programming, comments are text within the code that are ignored by the interpreter or compiler. They are used to explain what the code does, add notes or reminders, or to disable certain parts of the code during testing or debugging.

Comments are useful because they make the code more readable and help other programmers understand your intentions. Python supports two types of comments:

Single-line comments: These start with the hash symbol (#) and continue until the end of the line. Anything after the hash symbol on a line is ignored by the interpreter.


For example:

Thursday, 16 March 2023

Python Programming Tut#03|First Program|Hello, World

Python Tutorial 03

Once you have learned the basics of Python, you can start writing your first Python program. A simple "Hello, World!" program is a good place to start. Open up your text editor or IDE and create a new Python file. Type the following code:

print("Hello, World!")

Save the file with a .py extension, such as hello.py then run the program. This program simply prints the text "Hello, world!" to the console.

The first line of the program is print("Hello, World!"). This line is a function call that tells Python to print the text "Hello, world!" to the console.

Tuesday, 14 March 2023

Python Programming Tut#02

 Python Tutorial 02

Install Python: Before you can start writing Python code, you'll need to install Python on your computer. You can download the latest version of Python from the official Python website (https://www.python.org/downloads/). Follow the instructions to install Python on your computer.


Choose a text editor or Integrated Development Environment (IDE): Once you have Python installed, you'll need a way to write and edit Python code. You can use any text editor or IDE that you prefer. Some popular options include Visual Studio Code, PyCharm, Sublime Text, and Notepad++. Choose the one that you are most comfortable with.

Learn the basics of Python: Python is a high-level programming language that is easy to learn and use. It's a great choice for beginners who are just getting started with programming.

To check the Python version installed on your computer, you can open a command prompt or terminal and type the following command:

python --version

Saturday, 11 March 2023

Python Programming Tut#01

Python Tutorial 01

Python is a high-level, interpreted programming language that was first released in 1991. It is designed to be simple, easy to read, and easy to learn, making it a popular choice for beginners and experts alike.

Python has a wide range of applications, from web development and data analysis to artificial intelligence and machine learning. It has a large and active community of developers who contribute to open-source projects and share their knowledge and experience.