Analysis of Algorithms
UPSC IAS Exams Notes
Developer's Best Practices
Questions and Answers
Effective Resume Writing
HR Interview Questions
Who is Who
Difference between mutable and immutable in python?
Published on 27-May-2019 18:06:23
Python defines variety of data types of objects. These objects are stored in memory and object mutability depends upon the type, like Lists and Dictionaries are mutable it means that we can change their content without changing their identity. Other objects like Integers, Floats, Strings and Tuples have no provision ...
What is the process of compilation and linking in python?
Published on 27-May-2019 15:54:16
Compilation: The source code in python is saved as a .py file which is then compiled into a format known as byte code, byte code is then converted to machine code. After the compilation, the code is stored in .pyc files and is regenerated when the source is updated. This ...
What is prmonth() method in python?
Published on 24-May-2019 18:33:54
Python has an built-in module named Calendar that contains classes and functions to support a different varity of calendar operations, by default the calendar module follows the Gregorian calendar. prmonth() method is one of the methods of TextCalendar instance.is used to print a month’s calendar as returned by formatmonth(). Syntax: prmonth(year, month, ...
What is weekday() method in python?
Published on 24-May-2019 15:38:52
The weekday() method is used to returns the particular day of the week.Exampleimport datetime import calendar #defining function named called findweekDay def findWeekDay(date): i = datetime.datetime.strptime(date, '%d %m %Y').weekday() return (calendar.day_name[i]) date = '24 05 2019' print(findWeekDay(date))Outputfriday
What is itermonthdays2() in python?
Published on 24-May-2019 15:28:05
itermonthdays2().It is similar to itermonthdates(), Days returned will be tuples (i.e) it consists of a day number and a weekday number. this method is used to get an iterator for the month in the year.Exampleimport calendar i= calendar.Calendar() for days in i.itermonthdays2(2019, 5): print(days)Output(0, 0) (0, 1) (0, 2) (0, ...
Explain calendar module in python?
Published on 24-May-2019 15:04:55
Python has an inbuilt module and imports all the classes and functions in the module.Example#Write a python program to print month of a calendar? import calendar #prints may month calendar print(calendar.month(2019,5))OutputMay 2019 Mo Tu We Th Fr Sa Su 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
What is calendar module in python?
Published on 24-May-2019 14:34:11
Python has an inbuilt module and imports all the classes and functions in the module.Example Live Demo#Write a python program to print month of a calendar? import calendar #prints may month calendar print(calendar.month(2019,5))OutputMay 2019 Mo Tu We Th Fr Sa Su 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
What is itermonthdates() in python?
Published on 24-May-2019 14:17:39
itermonthdates() method will return all days for the month and all days before the start of the month or after an end of the month that are required to get a complete week.Exampleimport calendar #assigning variable to the calendar variable = calendar.Calendar() for day in variable.itermonthdates(2019, 5): print(day)Output2019-04-29 2019-04-30 2019-05-01 ...
Python and multi-threading. Is it a good idea?
Published on 23-May-2019 15:46:40
No its not a good idea, actually.Python doesn't allow multi-threading ,but if you want to run your program speed that needs to wait for something like IO then it use a lot. Where as the threading package couldnt let you to use extra CPU cores python doesn't support multi-threading because ...
What is the difference between .py and .pyc files ?
Published on 23-May-2019 15:18:12
Python compliles the .py files and save it as .pyc fileThe .pyc contain the compiled bytecode of Python source files, A .pyc is not created for your main program file that you execute (only for imported modules).The .pyc file contains encoded python bytecode.If We Want to import module.The Module calculate ...
Bookmark this page