Results for Python Program

Data Visualisation: Empowering Business with Effective Insights

logo

This virtual experience program is with Tata Insights and Quants or Tata iQ hosted on the platform Forage. We will gain insight into how passionate multi-disciplinary experts solve some of the most complex business problems using data visualization solutions, such as Tableau and Power BI and create amazing stories which are hidden under the mountains of data generated.

The program will show you what kind of problems are solved at Tata Insights and Quants on a day-to-day basis and will attempt to emulate the challenges you will be facing.

As a consultant hired by an online retail store, I was tasked with reviewing their data and providing valuable insights to the CEO and CMO. The objective was to analyze the major contributing factors to the company's revenue to help them plan strategically for the next year. The leadership wanted to view the metrics from both an operations and marketing perspective and seek guidance on areas performing well, so they could focus on what's working. They were also interested in understanding different metrics based on demographic information available in the data.

Task 1: Framing the Business Scenario
Learn how to anticipate the questions your business leaders will need answers to.

To prepare for the upcoming meeting with the CEO and CMO, I approached the task with a business leader's mindset, aiming to analyze the data effectively and present insights that would help evaluate the current business performance and suggest metrics for expansion.

I accessed the provided resources to better understand how business leaders think and approach business performance, which helped me gain valuable perspectives.

To prepare for your meeting, I need to draft questions that will be important and relevant to the CEO and CMO. I have reviewed the provided dataset to identify valuable information and insights. Based on my analysis, I have drafted four questions each for both the CEO and CMO, considering their distinct perspectives.

Questions for the CEO:
  1. What are the top-performing product categories in terms of revenue, and how have they evolved over the past year? Are there any specific trends or seasonal patterns that stand out?
  2. What regions or countries have shown the highest revenue growth, and what strategies have been employed in those regions to achieve such success? How can we replicate these strategies in other markets?
  3. How has the customer retention rate changed over the last year, and what initiatives have been implemented to improve customer loyalty? What can we do to further increase customer retention and lifetime value?
  4. What is the profitability breakdown across different customer segments, and which segments contribute the most to our overall revenue? Are there any untapped customer segments with growth potential?
Questions for the CMO:
  1. How effective have our marketing campaigns been in terms of customer acquisition and conversion rates? Which marketing channels have yielded the highest returns, and how can we optimize our marketing budget allocation?
  2. What are the key demographic insights of our customer base? How do different demographics (age, gender, location, etc.) impact customer behavior and preferences, and how can we tailor our marketing strategies accordingly?
  3. Are there any notable changes in customer sentiment or brand perception based on online reviews and feedback? How can we address any negative sentiment and leverage positive feedback to strengthen our brand image?
  4. What role does social media play in our revenue generation, and which platforms have been most impactful? How can we leverage social media influencers and user-generated content to expand our reach and engage with our target audience effectively?

By addressing these questions during the meeting, I intend to provide the CEO and CMO with actionable insights that will guide their decision-making process, help them evaluate the current business performance, and support their plans for strategic expansion.


Task 2: Choosing the Right Visuals
Learn which visuals are most effective in a given scenario.

In this task, I was tasked with providing visualizations to the CEO and CMO of an online retail store. The goal was to help them understand the company's performance, identify key strengths, and uncover growth opportunities for increased revenue. To ensure accurate representation of the data, I carefully gathered the requirements and created simple yet effective visuals. By using appropriate charts such as line graphs, bar graphs, map charts, I presented insights on sales trends, product category distribution, and correlations between marketing expenditure and revenue. The objective was to enable the senior management to quickly grasp the company's performance and make informed decisions for future growth and success.


Task 3: Creating Effective Visuals
Apply your under and create visuals based on business scenarios.

In this task, I have to create the visuals around four of the questions that the CEO and CMO have requested. In this task I used Tableau for the data visualization and to create a charts for the respective KPI.

Data cleanup
Before proceeding to data analysis there is a need for data cleanup. I observed that there were some negative values present in the quantity & price field that I have removed.
Also the client has provided 2 conditions for the data analysis.
  • Create a check that the quantity should not be below 1 unit
  • Create a check that the Unit price should not be below $0

Question 1
The CEO of the retail store is interested to view the time series of the revenue data for the year 2011 only. He would like to view granular data by looking into revenue for each month. The CEO is interested in viewing the seasonal trends and wants to dig deeper into why these trends occur. This analysis will be helpful for the CEO to forecast for the next year.


According to my analysis, there are some months of the year that experience exceptional growth. According to the data, the first eight months' revenue were relatively stable, with an average of $685k in revenue each month. The revenue rises by 40% over the prior month in September, marking the beginning of the revenue increase. This pattern persisted up until November, when it reached 1.5 million USD, the highest amount of the entire year. Unfortunately, since the data for December has been missing, no inferences can be made from it. This analysis shows how seasonality, which usually happens in the last four months of the year, impacts retail store sales.

Question 2
The CMO is interested in viewing the top 10 countries which are generating the highest revenue. Additionally, the CMO is also interested in viewing the quantity sold along with the revenue generated. The CMO does not want to have the United Kingdom in this visual.


The second visual shows how the top 10 countries which have opportunities for growth are performing. This data does not include the UK as the country already has high demand and I’ve been told you’re more focused on the countries where demand can be increased. The analysis shows that countries such as the Netherlands, Ireland, Germany and France have high volumes of units bought and revenue generated. I would suggest that these countries should be focused on to ensure that measures are taken to capture these markets even more.


Question 3
The top 10 countries with the most potential for growth are represented in the second graph. Since the UK already has a high demand and I understand you are more interested in countries where demand can be increased, the UK is not included in this data. According to the analysis, sales of units and revenue are very high in nations like the Netherlands, Ireland, Germany, and France. To ensure that steps are taken to further seize these markets, I would propose concentrating on these nations.


The top 10 customers who have made the most purchases from the store have been the focus of the third analysis. According to the data, there aren't many differences between the top 10 customers' purchases. The fact that the highest revenue-producing customer only spent 17% more than the second-highest demonstrates that the company does not rely solely on a small number of customers to generate revenue. This demonstrates that the company is in a strong position and that the customer's power of negotiation is low.


Question 4
The CEO is looking to gain insights on the demand for their products. He wants to look at all countries and see which regions have the greatest demand for their products. Once the CEO gets an idea of the regions that have high demand, he will initiate an expansion strategy which will allow the company to target these areas and generate more business from these regions. He wants to view the entire data on a single view without the need to scroll or hover over the data points to identify the demand. There is no need to show data for the United Kingdom as the CEO is more interested in viewing the countries that have expansion opportunities.


The map chart concludes by comparing the regions that have produced the most revenue to those that have not. Apart from the UK, it is clear that nations like the Netherlands, Ireland, Germany, France, and Australia generate high revenue, and the business should invest more in these nations to boost product demand. The map also reveals that the majority of sales occur exclusively in the European region, with only a small number in the American region. Along with Russia, there is no market for the products in Africa or Asia. Sales revenues and profitability could increase with the implementation of a fresh strategy focused on these areas.


Task 4: Communicating Insights and Analysis
Effectively communicate your findings and explain how it relates to each scenario.



In this task I represented my thought process and how I handled the data cleanup and visualisation phase. I clearly presented the analysis of all four questions from the previous task raised by CEO & CMO and provided context for each scenario and how it relates to their questioning.



Technology Topper Wednesday, August 02, 2023
Read more ...
Movie Ratings Analysis | Python Project | Pandas, Seaborn, Matplotlib

In this Python Data Analysis Project, I worked on a dataset that contains the different genres of movies, ratings received by the expert and audience, year of release, and budget in millions. While working on this project, I used the Pandas, Seaborn, and Matplotlib python libraries. By using these libraries, I built different types of graphs and charts, which helps us make the analysis easier. In this project, I have analyzed which movie genres are popular among the audience based on their ratings. We can suggest which genre would be best if the producer or director wanted to make a movie at the end of this project.

Python Code
        Most of the movies belong to the action, comedy, and drama genres, which shows that audiences are more interested in this type of movie. Movies with very high audience and critic ratings are considered to be highly liked. That happens mostly for action, drama, and thrillers. By analyzing this dataset, domain experts can make their decisions for upcoming movies that are popular among the audience as per their ratings. So, if a producer or director wants to make a film, the above-mentioned genre will be most preferred in order to get the best response from the audience and earn the most profit from that film.
Movie Ratings Analysis | Python Project




Technology Topper Wednesday, December 28, 2022
Read more ...

Python Program to find the sum of digits of a number | Using while loop

Python Program to find the sum of digits of a number
In this example, we will learn how to find the sum of all digits of a number in Python. Our program will take one number as input from the user, calculate the sum of its digits and print it out. We will use while loop to find the digits of the given number and use one variable to store the sum of all the digits.
For example if user enters the the number 4538, then output i.e. sum of digits will be equal to 20. (4+5+3+8=20)

Python Program to find the sum of digits of a number
Number = int(input("Please Enter any Number: "))
Sum = 0
while(Number > 0):
    Reminder = Number % 10
    Sum = Sum + Reminder
    Number = Number //10
print("Sum of the digits of Given Number = %d" %Sum)

Output:
Please Enter any Number: 4538 Sum of the digits of Given Number = 20

Run Code: If you want run this code copy this code, paste here and run.

Technology Topper Friday, June 25, 2021
Read more ...

Python Program to Swap Two Numbers | without using temporary variable & with using temporary variable

Python Program to Swap Two Numbers
Swapping of two numbers means, first number becomes second and second number becomes first. For example, if user enters any two number say 5 and 10. And let's suppose the two variables say a and b holds these two numbers. That is, a=5 and b=10. Then after swapping it will be like a=10 and b=5.
In this example, you will learn to swap two variables by using a temporary variable and, without using a temporary variable.


Python Program to Swap Two Numbers without using temporary variable:
a = 5
b = 10
print("Before swap a=",a,"b=",b)
a = a + b
b = a - b
a = a - b
print("After swap a=",a,"b=",b)

Output:
Before swap a= 5 b= 10
After swap a= 10 b= 5

Python Program to Swap Two Numbers with using temporary variable:
a=5
b=10
print("Before swap a=",a,"b=",b)
temp=a
a=b
b=temp
print("After swap a=",a,"b=",b)

Output:
Before swap a= 5 b= 10
After swap a= 10 b= 5

Run Code: If you want run this code copy this code, paste here and run.

Technology Topper Thursday, June 24, 2021
Read more ...

Python Program to Print Multiplication Table of a given Number

technology topper

In this example, you will learn to generate the multiplication table of a number entered by the user. In this program we will use for loop to generate multiplication table of number which is provided by user.

Python program:
num = int(input("Enter the number: "))
print("Multiplication Table of", num)
# Iterate 10 times from i = 1 to 10
for i in range(111):
   print(num,"X",i,"=",num * i)


Output:
Enter the number: 9 Multiplication Table of 9 9 X 1 = 9 9 X 2 = 18 9 X 3 = 27 9 X 4 = 36 9 X 5 = 45 9 X 6 = 54 9 X 7 = 63 9 X 8 = 72 9 X 9 = 81 9 X 10 = 90


Run Code: If you want run this code copy this code, paste here and run.

Technology Topper Monday, March 01, 2021
Read more ...

Python Program to Check Whether a Character is a Vowel or Consonant

Python Program to Check Vowel or Consonant

In the English language, the letters A, E, I, O, U and a, e, i, o, u are defined as a vowel. Except these all other letters are consonants. We can write a c program to check vowels or consonants using an if-else statement or by using switch-case statements.

Python Program to Check Whether a Character
ch = input("Enter an Alphabet: ")
if(ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u' or ch == 'A'
       or ch == 'E' or ch == 'I' or ch == 'O' or ch == 'U'):
    print(ch, "is a Vowel")
else:
    print(ch, "is a Consonant")

Output:
Enter an Alphabet: E E is a Vowel.
Enter an Alphabet: S
S is a Consonant.

Run Code: If you want run this code copy this code, paste here and run.


Technology Topper Sunday, February 28, 2021
Read more ...

Python Program to Find Factorial of a Number | Using for loop, while loop & recursion

Python Program
The Factorial is the product of all numbers, which are less than or equal to that number, and greater than 0.

n! = n * (n-1) * (n -2) * …….* 1
For example, Factorial of 5 is represented as 5! = 5 *4 * 3 * 2 * 1 = 120

C Program to Find Factorial of a Number
Using for loop:

number = int(input("Please enter a Number to find factorial "))

fact = 1

for i in range(1, number + 1):

    fact = fact * i

print("The factorial of %d = %d" %(number, fact))


Using while loop:

number = int(input("Please enter a Number to find factorial "))

fact = 1

i = 1

while(i <= number):

    fact = fact * i

    i = i + 1

print("The factorial of %d = %d" %(number, fact))


Using recursion:

def factorial(num):

    if((num == 0) or (num == 1)):

        return 1

    else:

        return num * factorial(num - 1)

number = int(input("Please enter a Number to find factorial "))

fact = factorial(number)

print("The factorial of %d = %d" %(number, fact))


Output:

Please Enter a number to Find Factorial 5

Factorial of 5 = 120

Please Enter a number to Find Factorial 10

Factorial of 10 = 3628800 


Run Code: 
If you want run this code copy this code, paste here and run.

Technology Topper Saturday, January 23, 2021
Read more ...

C Program and Python Interview Questions | Commonly Asked Technical Interview Questions 2021

Interview Questions
In this post, I will discuss the most important C Program and Python Interview Questions in order to make you familiar with the type of questions that can be asked during a job interview related to the C Program and Python.
The below-mentioned C Program and Python interview questions will assist you in clearing your basic concepts. If you find this post helpful then please make sure that you share this post with your friends.

C Program Interview Questions And Answers:
Q. Features of C Programming Language?
Ans: Procedural Language
Fast and Efficient
Modularity
Statically Type
General Purpose Language
Rich set of built in Operators
Libraries with rich Functions
Middle Level Language
Portability
Easy to Extend

Q. What is the main difference between the Compiler and the Interpreter?
Ans: Compiler is used in C Language and it translates the complete code into the Machine Code in one shot. On the other hand, Interpreter is used in Java Programming Language and other high-end programming languages. It is designed to compile code in line by line fashion.

Q. What are different storage class specifiers in C?
Ans: auto, register, static, extern

Q. What is NULL pointer?
Ans: NULL is used to indicate that the pointer doesn’t point to a valid location. 

Q. What is Dangling pointer?
Ans: Dangling Pointer is a pointer that doesn’t point to a valid memory location. Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.

Q. What is Preprocessor?
Ans: A Preprocessor Directive is considered as a built-in predefined function or macro that acts as a directive to the compiler and it gets executed before the actual C Program is executed.

Q. What is an array?
Ans: The array is a simple data structure that stores multiple elements of the same datatype. 

Q. What is typecasting?
Ans: Typecasting is a process of converting one data type into another is known as typecasting.

Q. What is a nested loop?
Ans: A loop that runs within another loop is referred to as a nested loop. The first loop is called the Outer Loop and the inside loop is called the Inner Loop.

Top 5 Best Smartphones Under Rs.30000 ⚡⚡⚡
Must Watch
Python Interview Questions And Answers:
Q. What is Python?
Ans: Python is a high-level, interpreted, interactive, dynamically typed and object-oriented scripting language. Python is designed to be highly readable.

Q. Features in Python?
Ans: Easy to code
Free and Open Source
Object-Oriented Language
GUI Programming Support
High-Level Language
Python is Integrated language
Interpreted Language
Dynamically Typed Language

Q. What are functions in Python?
Ans: A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.

Q. In Python what is slicing?
Ans: A mechanism to select a range of items from sequence types like list, tuple, strings etc. is known as slicing.

Q. What is a string in Python?
Ans: The string can be defined as the sequence of characters represented in the quotation marks. In Python, we can use single, double, or triple quotes to define a string.
Example: str2 = 'hello world' 

Q. What is a Lists in Python?
Ans: Python Lists are similar to arrays in C. However, the list can contain data of different types. The items stored in the list are separated with a comma (,) and enclosed within square brackets [].
example: mylist1 = ["apple", "banana", "cherry"]

Q. What is tuple in Python?
A tuple is a built-in data collection type. It allows us to store values in a sequence. It is immutable, so no change is reflected in the original data. It uses () brackets. 
example: tup1 = ("apple", "banana", "cherry")

Q. What is a dictionary in Python?
Ans: The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys.
example: dict={'Country':'India', 'Game':'Cricket', 'Color':'Blue'}

Q. What is the difference between list and tuple?
Ans: The difference between list and tuple is that list is mutable while tuple is not.

Q. What is lambda in Python?
Ans: It is a single expression anonymous function often used as inline function.



Technology Topper Tuesday, January 05, 2021
Read more ...

Python Program for Fibonacci Numbers | Using for loop, while loop & recursion

Python Program for Fibonacci Numbers

The Fibonacci series is a sequence where the next term is obtained by the sum of previous two terms.
Fibonacci series- 0, 1, 1, 2, 3, 5, 8, 13, 21,....etc. The first two numbers of Fibonacci series are 0 and 1.

Python Program to display Fibonacci series:
Using for loop
num = int(input("Enter the number of elements: "))
first = 0
second = 1
print("Fibonacci Series: ")
print(first, second, end=" ")
for i in range(2, num):
    next = first + second
    print(nextend=" ")
    first = second
    second = next

Using while loop
nterms = int(input("Enter the number of elements: "))
# first two terms
n1, n2 = 01
count = 0
if nterms <= 0:
   print("Please enter a positive integer")
elif nterms == 1:
   print("Fibonacci sequence upto",nterms,":")
   print(n1)
else:
   print("Fibonacci Series: ")
   while count < nterms:
    print(n1, end = ' ')# (end = ' ') to print value on same line 
    nth = n1 + n2
    n1 = n2
    n2 = nth
    count += 1

Using recursion
def recur_fibo(n):  
   if n <= 1:  
       return n  
   else:  
       return(recur_fibo(n-1) + recur_fibo(n-2))  
# take input from the user  
nterms = int(input("Enter the number of elements: "))  
if nterms <= 0:  
   print("Plese enter a positive integer")  
else:  
   print("Fibonacci Series:")  
   for i in range(nterms):  
       print(recur_fibo(i), end=" "#(end = ' ') to print value on same line 

Output
Enter the number of elements: 5 Fibonacci Series: 0 1 1 2 3 
Enter the number of elements: 9 Fibonacci Series: 0 1 1 2 3 5 8 13 21

Run Code- If you want run this code copy this code, paste here and run.
Technology Topper Saturday, December 19, 2020
Read more ...

Python Program to find HCF and LCM 

Python Program to find HCF and LCM
GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that divides both of them.

For example GCD of 20 and 28 is 4 and GCD of 98 and 56 is 14.


LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers. 
For example, LCM of 15 and 20 is 60, and LCM of 5 and 7 is 35.


Program to find GCD & LCM:
def compute_hcf(xy):
# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0and (y % i == 0)):
            hcf = i 
    return hcf
num1 = int(input("enter num1: ")) 
num2 = int(input("enter num2: "))
print(f"The HCF of {num1} & {num2} is: ", compute_hcf(num1, num2))
lcm= ((num1*num2)//compute_hcf(num1, num2))
print(f"The LCM of {num1} & {num2} is: ", lcm)

Output:
enter num1: 15 enter num2: 20 The HCF of 15 & 20 is: 5 The LCM of 15 & 20 is: 60
enter num1: 20
enter num2: 28
The HCF of 20 & 28 is: 4
The LCM of 20 & 28 is: 140


Run Code- If you want run this code copy this code, paste here and run.
Technology Topper Monday, December 07, 2020
Read more ...

Python Program to Find Factors of a Number | Using for loop, while loop & function

Python Program to Find Factors

The numbers which are completely divisible by the given value(remainder is 0) called as factors of a given number in C.

Example: Factors of 20 = 1,2,4,5,10,20.

Factors of 36 = 1,2,3,4,6,9,12,18,36.

In this example, you will learn to find all the factors of an number entered by the user using for loop, while loop, function & if statement in Python programming.


Program to Find Factors of a Number

Using for loop:

x = int(input("Please Enter any Number: "))
print("The factors of",x,"are: ")
for i in range(1, x + 1): #for loop
    if x % i == 0:
        print(i)


Using while loop:

number = int(input("Please Enter any Number: "))
value = 1
print("Factors of {0} are:".format(number))
while (value <= number): #While loop
    if(number % value == 0):
        print("{0}".format(value))
    value = value + 1


Using function:

def print_factors(x): #function for find factors
   print("The factors of",x,"are:")
   for i in range(1, x + 1):
       if x % i == 0:
           print(i)
num = int(input("Please Enter any Number: "))
print_factors(num) #function call

Output:
Enter a number to Find Factors 36 Factors of the Given Number are: 1 2 3 4 6 9 12 18 36
Enter a number to Find Factors 20
Factors of the Given Number are: 1  2  4  5  10  20
Enter a number to Find Factors 49 Factors of the Given Number are: 1 7 49

Run Code- If you want run this code copy this code, paste here and run.



Technology Topper Saturday, December 05, 2020
Read more ...