PYTHON BASICS

Hello World Program:



Variable Initiation:

syntax:

variable_name=value

example:

a=10



String initiation:



Data Structures:

There are few built in data structures available in python.
1. Lists
2. Tuples
3. Dicts
4. Strings
5. Sets
6. Frozensets

1. Lists:



2. Tuples:



3. Dicts:



4. Strings:



5. Set:



6. Frozenset:



While Loop:



While else Loop:



For Loop:



For else loop:



Nested while loop:



Control statement: pass



Control statement: continue



Concatenation of two strings:



Count Number of occurrences of a substring in a given string:



Printing Second and fourth line from a file:




Replace a string with user given string in a file:





Graphics output:

Draw a star:




Draw a Rectangle:




Draw a Triangle:




Draw a Circle:





Previous
« Prev Post