What is python?
Python is a high-level programming language, with dynamic semantics. It is a high-level built-in data structure, combined with dynamic typing and dynamic binding. In simple words, python is the easiest programming language to learn and understand. If we talk about its practical application it is much more practical than other programming languages in the market like C++, C, Java, Assembly, etc. It is a diverse language and be used with LINUX, macOS, etc,
How to install Python?
Python is a free programming language you can directly install it from its official website. To make coding fun you also need to Download an IDE which is VS code it is a free code editor from Microsoft, Just install it like a game.
print("Hello world congratson writing your first code. ")
#output/result= Hello world congratson writing your first code.
What are Modules in Python?
A module is a set of code that is already written for our convince. This file can be imported into the python program and can be used for various purposes. There are certain modules that come with Python and some we have to download from the internet using -pip manager for example pip install flask. Use Import to include a module in your project
import subprocess
What is a comment in Python?
Comments are the phases written by the programmer to increase the readability of the program, in simple words comment comments are a set of words that are not read by the compiler. There are two types of comments:
1. Single line comment(#)
2. Multiline comment('''-----''')
# Printing the variables
What is a variable in Python?
A variable is a name given to a memory location . In simple words, it works like a container used in our kitchens to string and numerical values. example:
a = 5
b = 4
c = "roses"
Use "type" to know which kind of variable it is
a_122 = mahattva
# a = 'Mahattva'
# a = "codewithmahattva"
b = 345
c = 45.32
d = True
# Printing the variables
print(a)
print(b)
print(c)
print(d)
# Printing the type of variables
print(type(a))
print(type(b))
print(type(c))
print(type(d))
What are data types in python?
In python, there are only 5 data types :
1. integers
2. float value
3. string
4. boolean
5. none
Rules to write variables in python :
1. A variable name can contain alphabets, digits, and underscores.
2. A variable name can only start with an alphabet or an underscore.
3. No while spaces are allowed to be used inside a variable name.
What is the operator in Python?
mainly four types of operators are there in python.
1. Arithmetic operator(+,-,*,/)
2. Assignment operator(=,+=,-=)
3. Comparison operator(==,>=,<=,!=)
4. Logical operator(and ,or , not)
a = 3
b = 4
# Arithmetic Operators
print("The value of 3+4 is ", 3+4)
print("The value of 3-4 is ", 3-4)
print("The value of 3*4 is ", 3*4)
print("The value of 3/4 is ", 3/4)
# Assignment Operators
a = 34
a -= 12
a *= 12
a /= 12
print(a)
# Comparison Operators
# b = (14<=7)
# b = (14>=7)
# b = (14<7)
# b = (14>7)
# b = (14==7)
b = (14!=7)
print(b)
# Logical Operators
bool1 = True
bool2 = False
print("The value of bool1 and bool2 is", (bool1 and bool2))
print("The value of bool1 or bool2 is", (bool1 or bool2))
print("The value of not bool2 is", (not bool2))
Nice
ReplyDeleteThanks For support
Delete