Pawandeep has Published 42 Articles

How long does it take to learn Python?

pawandeep

pawandeep

Updated on 11-Mar-2021 09:07:26

299 Views

How fast can someone learn or excel in something completely depends on one’s interest in learning, dedication and persistence.Now, how long does it take to learn Python depends on how much do you want to learn.The basics of Python which include functions, loops, conditional statements, datatypes, etc., would take about ... Read More

Is Python a scripting language?

pawandeep

pawandeep

Updated on 11-Mar-2021 09:06:44

5K+ Views

Yes, Python is a scripting language.Scripting language v/s Programming languageThe first question which strikes into the mind is, what is the difference between programming and scripting language. The only difference which exists is that the scripting language does not require any compilation, it is directly interpreted.For example, the programs written ... Read More

How to declare a global variable in Python?

pawandeep

pawandeep

Updated on 11-Mar-2021 09:06:20

4K+ Views

What is a global variable?A global variable is a variable that is declared outside the function but we need to use it inside the function.Example Live Demodef func():    print(a) a=10 func()Output10Here, variable a is global. As it is declared outside the function and can be used inside the function as ... Read More

Write a program to form a cumulative sum list in Python

pawandeep

pawandeep

Updated on 10-Mar-2021 14:26:20

3K+ Views

The cumulative sum till ith element refers to the total sum from 0th to ith element.The program statement is to form a new list from a given list. The ith element in the new list will be the cumulative sum from 0 to ith element in the given list.For example, ... Read More

How to round off a number in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 14:18:23

850 Views

Python has an inbuilt round() function to round off a number.The round() method in Python takes two parameters −The first one is the number to be rounded off.The second one specifies the number of digits to which the number must be rounded off.Here, the second parameter is optional.If second parameter ... Read More

How to print pattern in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 14:15:23

2K+ Views

Patterns in Python can be printed using nested for loops. The outer loop is used to iterate through the number of rows whereas the inner loop is used to handle the number of columns. The print statement is modified to form various patterns according to the requirement.The patterns can be ... Read More

How to reverse a number in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 14:12:28

2K+ Views

Reversing an integer number is an easy task. We may encounter certain scenarios where it will be required to reverse a number.Input: 12345 Output: 54321There are two ways, we can reverse a number −Convert the number into a string, reverse the string and reconvert it into an integerReverse mathematically without ... Read More

How to create a dictionary in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 14:05:15

2K+ Views

A Dictionary in Python is a type of data structure.It consists of a collection of key-value pairs. Each key in the dictionary is unique. Each unique key in the dictionary is associated to its value. Thus, Dictionary holds key : value pairs.We will be discussing how to create a dictionary ... Read More

How to convert int to string in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 14:03:57

1K+ Views

Type conversion is at times needed when the user wants to convert one data type into another data type according to requirement.Python has in-built function str() to convert an integer to a string. We will be discussing various other methods in addition to this to convert int into string in ... Read More

How to convert list to string in Python?

pawandeep

pawandeep

Updated on 10-Mar-2021 13:59:46

2K+ Views

There may be some situations, where we need to convert a list into a string. We will discuss different methods to do the same.IterationIterate through the list and append the elements to the string to convert list into a string. We will use for-in loop to iterate through the list ... Read More

Advertisements