-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro.py
More file actions
62 lines (34 loc) · 2.51 KB
/
Copy pathintro.py
File metadata and controls
62 lines (34 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# python is a programming language whihc is very simple and easy to use.
# we can insatll any module with the use of pip . by using this pip we can install any module
# 2 type of modules:-
# built in-already present when you download python
# external-we have to download by using pip
# pip is a package manager.
# print is a function in python which is used to print something.
# we can also execute python code by writing python filename in terminal of vs code
# the line of code which we dont want to execute so we can comment it .
# types of comments-
# single line- denoted by #
# multi line comment- '''comment here'''
# escape sequence character - to insert character that cannot be used as string we use escape sequence character.
# for e.g. \n
# we can add multiple values inside print statement and that multiple values we can seperate by using sep="=" with the values in print statement.
# end is also a parameter end="" which tell that when this line is executed then which thing to print
# variables are containers that holds data creating a variable is like creating a placeholder in memory
# a string data type is denoted by "" double quotes.
# data type specifies type of value a variable can holds. this is reqired to perform operations without causing error.
# python has built in data types such as int string boolean etc.
# boolean has only 2 values true or false.
# list is a collection of items that are of different data types. they are immutable means that they cannot be changed.
# dictionary is a collection of key value pairs.
# in python all is object such as int char string etc. boolean are object
# Type casting is the process of conversion of one data type to other data type
# for e.g. we can typecast a="9" to integer by int(a) but the value inside a must be valid for the provided data type
# types of typecasting:
# implicit-when python itself does the conversion
# explicit-when the programmer itself do the conversion.
# In Python, when the data type conversion takes place during compilation or during the runtime,
# for e.g. if there are 2 variables one is of int data type other is of float and if we add these 2 then the result will be in float
# we can also give inputs to our python program by input function that takes a string . and if we needs int as an input then we can use int before input function such as int(input())
# whenever we enclosed something in double or single quotes then it is considered string.
# to print a multiline string we can use ''' triple double or single quotes.