Getting Started with Python
Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented programming, imperative, functional, and procedural styles. It has a large and comprehensive standard library.
You can download and install python from here.
Hello, World in Python using IDLE
IDLE is a simple editor for python that comes bundled with python.
Open IDLE on your system, it will open a shell with options along at the top.
- In the shell, there is a prompt of three right angle brackets:
- Now write the following code in the prompt:
print(“Hello, World”)
- Hit Enter
Creating variables and assigning values
<variable name> = <value>
Python uses = to assign value to variables, There is no need to declare a variable in advance, or to assign a data type of it. Assigning a value to a variable itself declares and initializes the variable with that value. There is no way to declare a variable without assigning it an initial value.
# Integer
a = 2
print(a)
# Output: 2
# Floating Point pi = 3.14 print(pi) # Output: 3.14
# String name = "Aman Kharwal" print(name) # Output: Aman Kharwal
# Boolean a = True print(a) # Output: True Variable assignment works from left to right. So, the following code will give you error. 0 = x print(x) SyntaxError: can't assign to literal
Datatypes
Numbers:
Int: Integer a = 2 b = 25 c = 100
Float: Floating Point a = 2.0 b = 500.e0 c = 1245687979.e1
Complex: a = 2 + 10j b = 100 + 100j
Strings a = "Aman" b = "Kharwal" c = "Aman Kharwal"
Sequences and Collections:
Tuple: An ordered collection of n values of any type (n >= 0). a = (1, 2, 3) b = ('a', 1, (1,2)) List: An ordered collection of n values (n >=0) a = [1, 2, 3] b = ['a', 1, [1, 2, 3], [3, 2, 'd']]
Set: An unordered collection of unique values. Items must be hashable. a = {1, 2, 'a'} Dict: An unordered collection of unique key-value pairs, keys must be hashable. a = {1 : 'one', 2 : 'two'} b = {'a' : 'apple', 'b' : 'book'}
Great website to learn python 👍
Thanks
Tks , it’s so helpful
Thanks keep visiting our site
Best website to learn python
Thanks Keep coming back
Its so helpful, to learn the python. It is the best place to choose how to learn it. Thankyou for your help.
Thankyou so much, keep visiting our site.
Keep it up best tutorial
Thanks keep visiting our website
Thanks,it’s too much help .
Thankyou keep coming back to our website
I am happy to study this course. it is valuable. I didn’t have experience in python,but now,I am able to deal with it.
Thanks Aman kharwal
thanks keep coming back to us
I am very happy to get the knowledge and experience in python. I am happy to study this course
thanks keep visiting us
Thanks for providing tutorials, you are really provide a quality content.
thanks keep visiting our website
Great website 👍
thanks keep visiting us
It’s a best platform to learn python.
Thanks keep coming back
This is a best website to learn machine language and thanks to give deep knowledge about machine language .
Thanks, Keep visiting us
Hi sir, your website is too good and usefull .
Thanks, keep visiting us
It’s to much good and a complete python learning site .. its really attractive and cool one ❤️❤️✌️✌️ keep growing like this ..
Thanks keep visiting us
Great content keep up good work
Thanks, keep visiting us🤝
It’s a best website for learn machine language..keep it up..
Thanks, keep visiting us
Best site to learn great content
Thanks, keep visiting us
Amazing website 💕💯
Thanks, keep visiting us⭐⭐
Am soo pleased to learn tern wid this site
Its soo helpfull and very easy way to learn language.
Tnkx for this amazing way of knowledge 👍🏻
Thanks Taruna, keep visiting us
This is a very nice tutorial. Python really is one of the greatest course out there. That is why my friend decided to start a youtube channel with python tutorials. Please do check it out: https://www.youtube.com/channel/UCCI4DQohGipZcUThvY6cLeA