Zend Anwar

Full stack web developer

Author: zendnwar

Difference between lamda and def in Python

def can contain multiple expressions whereas lamda is a single expression function def creates a function and assigns a name so as to call it later. lambda creates a function and returns the function itself def can have return statement. lambda cannot have return statements lambda can be used inside list, dictionary.

Read More

Python List Comprehensions

>>> sqr = [] >>> for i in range(10): sqr.append(i**2) >>> sqr [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] Combination  comb = [] >>> for i in [1, 5, 3]: for j in [2,1,5]: if i!=j: comb.append((i,j)) >>> comb [(1, 2), (1, 5), (5, 2), (5, 1), (3, 2), (3, 1), (3, […]

Read More

Python Lists as Stacks

>>> stack = [11,22,33,44,55,66,77] >>> stack.append(88) >>> stack [11, 22, 33, 44, 55, 66, 77, 88] >>> stack.append(99) >>> stack [11, 22, 33, 44, 55, 66, 77, 88, 99] >>> stack.pop() 99 >>> stack.pop() 88 >>> stack.pop() 77 >>> stack.pop() 66 >>> stack [11, 22, 33, 44, 55]

Read More

Data structure in python

Python list >>> arr = [22, 33, 44, 55, 66, 77, 1, 2, 3, 4, 5, 6] >>> arr [22, 33, 44, 55, 66, 77, 1, 2, 3, 4, 5, 6] >>> arr.index(2) 7 >>> arr.remove(77) >>> arr [22, 33, 44, 55, 66, 1, 2, 3, 4, 5, 6] >>> arr.reverse() >>> arr [6, 5, […]

Read More

Python Keywords and Identifier

Keywords Keywords are the reserved words in Python. We cannot use a keyword as variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language. In Python, keywords are case sensitive. Python is a dynamic language. It changes during time. The list of keywords may […]

Read More

Write a Hello World Python Program in linux

$ vim zendanwar.py #!/usr/bin/python # Hello world python program print “Hello python World!” save the the file Make the permission with following comman $ chmod +x zendanwar.py lastly run your file $ zendanwar.py output : Hello python World!

Read More

how to check python version in linux?

It’s very simple: python –version or python -V

Read More

dbModel read resource does not implement Zend_Db_Adapter_Abstract in Magento

It’s very simple solution: just clear /var/cache it’s not yet solved, just make /var/cache &  /var/sessions permission 777  

Read More

river:ingroup friendlytime:hours:singular in elgg

Please check root directory “languages” folder is missing or not. otherwise check languages/en.php and update your version wise en.php file.  

Read More

How to configure Web Server on Red Hat Enterprise Linux 7?

Port : 80 (default) Daemon : httpd configuration file :  etc/httpd/conf/httpd.conf Web page location : /var/www/html/ Check httpd : [root@server8~]  rpm -qa|grep httpd if not install package just install httpd package [root@server8~] yum install httpd -y   // installed your package [root@server8~] systemctl  restart httpd       //restart your package [root@server8~] systemctl  enable httpd    // enable your package [root@server8~] firewall-cmd      […]

Read More