Hafeezul Kareem has Published 344 Articles

Ways to increment a character in python

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Jun-2020 13:48:16

10K+ Views

In this tutorial, we are going to see different methods to increment a character in Python.TypecastingLet's first see what happens if we add an int to char without typecasting.Example Live Demo## str initialization char = "t" ## try to add 1 to char char += 1 ## gets an errorIf you ... Read More

Calculating Wind Chill Factor(WCF) or Wind Chill Index(WCI) in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:40:14

345 Views

In this tutorial, we are going to learn how to calculate Wind Chill Index in Python. We have the formula to calculate the WCI and it's straightforward. We are going to use the following formula to calculate the WCI.Twc(WCI) = 13.12 + 0.6215Ta – 11.37v+0.16 + 0.3965Tav+0.16whereTwc = Wind Chill Index ... Read More

Different Methods to find Prime Number in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:39:11

1K+ Views

In this tutorial, we are going to explore different methods to find whether a given number is valid or not. Let's start without further due.Method-1It's a general method to find prime numbers.If the number is less than or equal to one, return False.If the number is divisible by any number, ... Read More

Lambda expression in Python Program to rearrange positive and negative numbers

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:34:21

574 Views

In this tutorial, we are going to write an anonymous function using lambda to rearrange positive and negative number in a list. We need the pick the negative numbers and then positive numbers from a list to create a new one.AlgorithmLet's see how to solve the problem step by step.1. ... Read More

Log functions in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:32:25

347 Views

In this tutorial, we are going to learn about the logarithmic functions from math module. We have four variants of logarithmic functions. Pythons' provides all of them in the math module. Let's learn about them one by one.math.log(number, [Base])The math.log(number, [Base]) method is used to compute the logarithm of any ... Read More

Private Variables in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:30:05

3K+ Views

In this tutorial, we are going to learn about the private variables in Python classes.Python doesn't have the concept called private variables. But, most of the Python developers follow a naming convention to tell that a variable is not public and it's private.We have to start a variable name with ... Read More

Python Dictionary Comprehension

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:26:13

240 Views

In this tutorial, we are going to learn how to use dictionary comprehensions in Python. If you are already familiar with list comprehension, then it won't take much time to learn dictionary comprehensions.We need the key: value pairs to create a dictionary. How to get these key-value pairs using dictionary ... Read More

Program to print its script name as output in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:20:22

922 Views

In this tutorial, we are going to write a program that prints the name of the Python script file. We can find the script name using the sys module.The sys module will store all the command line arguments of python command in the sys.argv list. The first element in the ... Read More

try and except in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:17:13

362 Views

In this tutorial, we are going to learn about the try and except of Python. Python has a concept called error and exception handling.The keywords try and except are used in the error and exception handling.Basically, we will find two types of errors in Python. They are −Syntax errors - ... Read More

Unit Testing using Unittest in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:12:21

580 Views

In this tutorial, we are going to learn about Unit Testing using the unittest built-in module. Testing plays a major role in software development. You will know the issues before going to the production itself.We'll learn the basics of testing in Python using the built-in module called unittest. Let's jump ... Read More

Advertisements