Sri has Published 20 Articles

What are the tools that help to find bugs or perform static analysis in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

1K+ Views

Pychecker and Pylint are the static analysis tools that help to find bugs in python.Pychecker is an opensource tool for static analysis that detects the bugs from source code and warns about the style and complexity of the bug.Pylint is highly configurable and it acts like special programs to control warnings and errors, it ... Read More

How to Create and Assign Lists in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

2K+ Views

We can Create and Assign List by Insert, Append Length, Index, Remove and Extend, etc.. Lists are mutable and the changeble object is enclosed within the square brackets i.e [ ], Lists in python is easy.Examplelist =["Tutorials ", "Point", "Pvt", "Ltd"] listOutput['Tutorials ', 'Point', 'Pvt', 'Ltd'] Assign Values in Lists To assign values ... Read More

What does immutable mean? Which Python types are mutable and which are not?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

332 Views

In Python, there are two types of Objects.Mutable ObjectImmutable ObjectMutable: Mutable objects are modified, (i.e) objects are a changeable list, set, dict, etc are mutable.mutable objects are easy to change.Example 1list =["Tutorials ", "Point", "Pvt", "Ltd"] list[2]= 'Tutorix' listOutput['Tutorials ', 'Point', 'Tutorix', 'Ltd'] Example 2list=['Car', 'Bike', 'Scooty', 'Bus', 'Metro'] list[4]= ... Read More

Can generator be used to create iterators in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

238 Views

Yes, We can create a generator by using iterators in python Creating iterators is easy, we can create a generator by using the keyword yield statement. Python generators are an easy and simple way of creating iterators. and is mainly used to declare a function that behaves like an iterator.The generator ... Read More

What is the difference between .py and .pyc files ?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

2K+ Views

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 ... Read More

What is itermonthdates() in python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

174 Views

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 ... Read More

Explain calendar module in python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

240 Views

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 itermonthdays2() in python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

100 Views

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, ... Read More

What is weekday() method in python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

135 Views

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 prmonth() method in python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

119 Views

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, ... Read More

Advertisements