Python automated unit testing – Pytest framework

I have come across an excellent quick and easy pytest framework learning course material from youtube channel “code basics”.

It has four simple video parts:

Part 1: Python unit testing – pytest introduction

Part 2: Python unit testing – skip/selectively run tests in pytest

Part 3: Python unit testing – pytest fixtures

part 4: Python unit testing – pytest parameters

Source:  codebasics youtube channel

Thanks for “codebasics” team for making such a easily understandable way learning videos.

Python Tuple Initialization with one value – Quick and Easy Thumb Rule:

To create a tuple with one element, you need to do this:

>>> my_tuple = (1,)                  # Note the trailing comma after the value 1
>>> type(my_tuple)
<type ‘tuple’>

But if you do this

>>> my_tuple = (1)
>>> type(my_tuple)
<type ‘int’>

you don’t get a tuple. I thought that just putting a value inside ( )
would make a tuple. Apparently that is not the case. I hate ugly code
so it would be clean if Python would convert anything put into ( ) to
be a tuple, even if just one value was put in use comma after the value, For example:  “my_tuple = (1,) “.

Google App Engine for Python – part 2

Google App Engine for Python Part 2 – Deploying

Quick description:

This video will explains about how to deploy/host your python application into internet using google app engine. Once you application is hosted in internet, it can be run from anywhere using the “”  whereas appname is your application name.

Example: Say app name is “sample”, then the final url will be

Please read the above paragraph before watching the video

Source: Stefano Locati youtube video

Google App Engine for Python – Part 1

Google App Engine for Python Part 1- Hello World

Quick description:

This video will explains about how to deploy/host your python application into local machine. After the application hosting, it can be run by typing the following command on your web browser “localhost:portnumber” whereas port number is one which you set during the application creation

Example: localhost:8080

Please read the above paragraph before watching the video

A quick start video for start working in Google app engine using python

Source: Stefano Locati youtube video

Differences between military time and 24 hour time

Military time is very similar to 24 hour time.

There are 2 differences between the military time setting and the 24 hour time setting. Military time uses a leading zero and doesn’t have a colon, while 24 hour time uses a colon but not a leading zero. So 8 o’clock am is shown as 0800 in military and 8:00 in 24 hour time. 8 pm would be 2000(military) and 20:00(24 hour).

Knowing these differences will help with deciding which time format will be of most use for specific purposes.

Difference between ‘int main()’, ‘void main()’ and ‘main()’ function in the C programming language

Solution 1:

Like any other function, main is also a function but with a special characteristic that the program execution always start from main. So the function main needs arguments and a return type. These int and void are its return type. Void means it will not return any value, which is also allowed.
But if want to know whether the program has terminated successfully or not, we need a return value which can be zero or a non zero value. Hence the function becomes int main () and is recommended over void main ().

Next question will strike into our minds will  be –
The same thing we can do by using getch() (for void main). then why int main is suggested?? Is there any advantage of int main over void main??

Because, the standard statements are:
int main(void)
int main(int argc, char **argv)

You can also use main() simply that means same as int main()..
int main() returns an exit value to compiler and works on most compilers.
And getch() as you mentioned has nothing to do with it. It gets character input on screen or else holds screen in other words

Solution 2:

void main() { ... } is wrong. If you’re declaring main this way, stop. (Unless your code is running in a freestanding environment, in which case it could theoretically be correct.)

main() { ... } is acceptable in C89; the return type, which is not specified, defaults to int. However, this is no longer allowed in C99. Therefore…

int main() { ... } is the best way to write main if you don’t care about the program arguments. If you care about program arguments, you need to declare the argc and argv parameters too. You should always define main in this way. Omitting the return type offers no advantage in C89 and will break your code in C99.

C Thumb rule and standards followed:

1. int main() is preferred over void main(), as per standards, and most new compilers supports int main() rather than void main().
2. int main() can help to return the error code if your program fails due to some error.