Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Sunday, 19 March 2023

Here are 50 common Python interview programs:

No comments :

python interview questions

In this post, we have given the interview questions at the very beginner level.


  1. Write a program to print "Hello, World!".

  2. Write a program to swap two variables.

  3. Write a program to find the largest number among three numbers.

  4. Write a program to check whether a number is even or odd.

  5. Write a program to find the sum of natural numbers up to a given number.

  6. Write a program to find the factorial of a number.

  7. Write a program to check whether a given string is a palindrome or not.

  8. Write a program to count the number of vowels in a given string.

  9. Write a program to reverse a string.

  10. Write a program to check whether a given number is a prime number or not.

  11. Write a program to find the Fibonacci series up to a given number.

  12. Write a program to find the GCD of two numbers.

  13. Write a program to find the LCM of two numbers.

  14. Write a program to convert Celsius to Fahrenheit.

  15. Write a program to convert Fahrenheit to Celsius.

  16. Write a program to find the roots of a quadratic equation.

  17. Write a program to find the area of a circle.

  18. Write a program to find the area of a triangle.

  19. Write a program to find the perimeter of a rectangle.

  20. Write a program to find the perimeter of a square.

  21. Write a program to find the area of a rectangle.

  22. Write a program to find the area of a square.

  23. Write a program to find the sum of digits of a given number.

  24. Write a program to find the number of digits in a given number.

  25. Write a program to check whether a given number is a palindrome or not.

  26. Write a program to find the ASCII value of a character.

  27. Write a program to find the HCF of two numbers.

  28. Write a program to find the sum of the digits of a given number until the sum becomes a single digit.

  29. Write a program to find the sum of even and odd numbers in a given list.

  30. Write a program to find the maximum and minimum elements in a given list.

  31. Write a program to remove duplicates from a given list.

  32. Write a program to sort a given list in ascending and descending order.

  33. Write a program to find the second largest element in a given list.

  34. Write a program to find the second smallest element in a given list.

  35. Write a program to reverse a given list.

  36. Write a program to find the sum of all numbers in a given list.

  37. Write a program to find the average of all numbers in a given list.

  38. Write a program to find the median of all numbers in a given list.

  39. Write a program to find the mode of all numbers in a given list.

  40. Write a program to find the frequency of each element in a given list.

  41. Write a program to find the common elements between two given lists.

  42. Write a program to merge two given lists and remove duplicates.

  43. Write a program to count the number of occurrences of a given element in a given list.

  44. Write a program to find the intersection of two given lists.

  45. Write a program to find the union of two given lists.

  46. Write a program to find the difference between two given lists.

  47. Write a program to remove the nth element from a given list.

  48. Write a program to find the sum of elements in the diagonal of a matrix.

  49. Write a program to find the transpose of a matrix.

  50. Write a program to multiply two matrices.

 

Read More

Sunday, 17 July 2022

What is Data Science? - End to End project - part 1

No comments :

 


In this post, we will see how a simple data science project life cycle will be!

Data Science Project Life Cycle

1. Understanding the Business Problem


Without a business requires no project exists. So once the client approached us for a solution. Then we have to understand their business problem and requirements. We have to get clarification of all of your questions and queries initial stage of the project to avoid back and forth.

The client will approach a data science firm which will be mostly a Marketing Research firm or Data Analysis firm.

They will have a kick-off call meeting where they will discuss the business problem statement and their requirements with the technical team and frame the steps to be executed.

After the meeting they will identify the below:

1. Exact Problem statement
2. Where and how to collect data from
3. Budget and Duration of the Project 
4. Required Output files
 

2. Data Collection

Once the problem statement is identified and the data collection process is defined then the project goes live.

Data Collection:

There are various ways to collect data.

1. Survey
2. Telephonic Interview data
3. Data collected from real-time places such as hospitals, clinics, and individual persons.


The data will be collected based on the requirements of the client, they most probably define a questionnaire to collect the data.

Once the data is ready the project will start in terms of technical part.

3. Data Analysis

Data analysis is the major part of a Data Science project. It is also the crucial part of the entire project where all the other projects depend on the data provided by the data analysis team. So it is really very important to work more cautiously when doing the data analysis.

There are different tools to do the data analysis which we will discuss in the upcoming episodes.

During the data analysis process, the team will prepare a cleaned version of data after checking the data quality, genuine form of data and more focus on the valid data.

The team will also build some partial insights with visualization for the client to look at to know that the project is on right track. Also the client can direct the team to focus on a few areas based on the analysis they did so far.

4. Machine Learning Model

Most of the projects can be 90% completed once the Data analysis project is over. Only a few projects need a machine learning model based on the complexity of the data and volume of the data. 

The Machine Learning models will be helpful to automate our work and make the big volume of data analysis in a simple and faster manner. We will learn more about machine learning in upcoming episodes.

5. Insights

Finally, we will get prepared with the insights and output files in the format the client has requested. It can be a simple excel, CSV file, text file, pdf, charts, graphs, slides etc...

There will be a secured mode of communication to deliver the projects.

Based on the client's suggestion there might be some more tune-up in the insights else the project can be sign-off.

Hope this article might be helped you in understanding what a data science project will be like. In upcoming episodes, I will share the tools and technical part of data science. 


Read More

Saturday, 16 July 2022

What is Data Science?

3 comments :


 


Data Science is a combination of multiple disciplines that use statistics, data analysis and machine learning to analyze data and extract knowledge and insights from it.

What is the Use of Data Science?




 Data Science is the art of providing insights based on the provided data from the client or data collected based on the business requirement.

Data Science is a field that has gained significant attention in recent years, thanks to the increasing importance of data-driven decision making. In simple terms, Data Science is the process of extracting insights and knowledge from large and complex data sets.

The field of Data Science is interdisciplinary and draws on concepts from computer science, statistics, mathematics, and other related fields. It involves a combination of data collection, cleaning, processing, analysis, and visualization, with the ultimate goal of extracting meaningful insights that can be used to inform business decisions.

One of the key benefits of Data Science is that it allows organizations to gain a deeper understanding of their customers, operations, and overall performance. By analyzing data, businesses can identify trends, patterns, and areas for improvement, which can ultimately lead to increased efficiency, profitability, and customer satisfaction.

Data Science is also a rapidly growing field, with high demand for skilled professionals who can work with large and complex data sets. In fact, according to the U.S. Bureau of Labor Statistics, employment of computer and information research scientists (which includes Data Scientists) is projected to grow 19 percent from 2020 to 2030, much faster than the average for all occupations.

If you're interested in pursuing a career in Data Science, there are a variety of educational and training programs available, ranging from online courses to degree programs. Many of these programs focus on developing skills in areas such as data analysis, machine learning, and programming.

In conclusion, Data Science is an exciting and rapidly growing field that offers numerous opportunities for skilled professionals. By leveraging the power of data, businesses can gain valuable insights that can help them make better decisions and achieve greater success. If you're interested in pursuing a career in Data Science, there are a variety of resources available to help you get started.

That Insight will be the output of a data science project where it will help us to make any of the below.

1. Decision Making

2. Prediction

3. Pattern recognition

these things will help us to make better decisions on business plans, products to be launched, prioritising the priority work, and strategies that will make more revenues.

This is why companies invest a lot in data science.

In the upcoming post, we will learn about How an End to End data science project will be, and what are the opportunities in this domain.



Read More

Thursday, 17 February 2022

Python practice programs for beginners - Day 20

2 comments :

 


Day 19 Solution:

adding items to list in python


Output:


Practice the same kind of programs and if you practice any new program kindly mention in it in comments.

Also read: How to install Android Studio


Read More

Python practice programs for beginners - Day 19

1 comment :

 

Python practice programs for beginners - millioninformations

Day 18: Solution




Day 19: Getting list items from users at run time and printing it.



You can practice the above program.

Day 19 Task: Get the Hollywood movie list going to get released in 2022 Summer from the user and print it.




Read More

Python practice programs for beginners - Day 18

1 comment :

Python practice programs for beginners - millioninformations

 Day 17 Solution:



Day 18: Introduction to List

A list is a collection of items. The items can be of any type.

Example: [1,2,3,5.5,"a",True]

How to print a list in Python?

Output: 

[1, 2, 3, 4, 5.5, True]


But if we want to print the list items alone we need to use for loop.



Output:

1

2

3

4

5.5

True


Day 18 Task: Create a list for latest gadgets and display it.





Read More

Monday, 14 February 2022

Python practice programs for beginners - Day 17

1 comment :

 

Python practice programs for beginners - 17

Day 16: Solution

Python Multiplication table program

Output:

Python Multiplication table program


Day 17: While loop

Syntax:

while condition to check:

    statement to be executed

Example: 

   



Day 17 Task: 

Get a number from the user and print the odd numbers in that range.





Read More

Saturday, 12 February 2022

Python practice programs for beginners - Day 16

1 comment :

 

Python practice programs for beginners - Millioninformations

Day 15 Solution:


Output:

for loop even number


Day 16: For Loop

Mini Project 2:

Get a number from the user and display the multiplication table of that number. You can also get them up to which number you can display the table.



Read More

Friday, 11 February 2022

Python practice programs for beginners - Day 15

1 comment :

 

Python practice programs for beginners - Day 15


Day 14 Solution:


Output:

Day 15 : for loop

If you see in the above picture the output is starting from 0 and ending with 9. If we want to start from 1 to 10 then we need to change the code in the range.


In this we have to use from 1 to 11 (10+1) because the loop runs from 1 to whatever the value mentioned at end position -1.

Output:

Day 15 Task: 

Get start value and end value from the user at run time and print all the even numbers between that range.


Read More

Thursday, 10 February 2022

Python practice programs for beginners - Day 14

1 comment :

 

Python practice programs for beginners - Day 14


Day 13 Solution:

Python Grade Checker Project Source Code:

Download Source code


Day 14: for loop

Syntax: 

for val in sequence:

    statements to be expected in the loop

val - variables

sequence - may be a range or list of items

Example:

Output:


Task: Print your name 10 times






Read More

Wednesday, 9 February 2022

Python practice programs for beginners - Day 13

1 comment :

Python practice programs for beginners - millioninformations

 
Welcome to Day 13 of the 30 days Challenge.

Day 12 Solution:


Day 13: 

So far we have practised on

1. Variables
2. Operators
3. Control statements
4. String formatting

with the help of all these try to do the below task:

Project 1: Grade Checker Project

Get a student details such as:

Name:

School/College:

City:

Subject 1 mark :

to

Subject 5 mark:

Then calculate the following details and display them:

Total:

Average:

Pass/Fail:

Grade:

Grade Calculation based on Average value:

91 to 100 - A+

86 - 90 - A

80 - 85 - B+

79 - 84 - B

70 - 78 - C

60 - 69 - D

50 - 58 - E

Below 50 - F

Sample Output:

Python - grade checker program

Will see the solution in the next post.


Read More

Tuesday, 8 February 2022

Python practice programs for beginners - Day 12

1 comment :

 

Python practice programs for beginners - millioninformations


Day 11 solution:


Output:


Day 12: String Format

In the above program instead of using 

print(number3," is the greatest number")

We can use 

 print(f'{number3} is the greatest number')

f --> format

' --> single apostrophe used to say that it follows String formatting. 

{} -->  we can use the curly braces for the placeholders where we can mention the variable name.

Task:

Try to reprogram the above logic using String formatting.




Read More

Monday, 7 February 2022

Python practice programs for beginners - Day 11

3 comments :

 

Python practice programs for beginners - millioninformations


Day 10 Solution:




Day 11: If elif


If we want to check more scenarios we can use if elif

Syntax:

if condition 1:

    Statement to be executed if the condition is True

elif condition 2:

     Statement to be executed if the condition is True

elif condition 3:

     Statement to be executed if the condition is True

Day 11 Task: Get three numbers from the user and try to find the smallest of those three numbers.



Read More

Python practice programs for beginners - Day 10

2 comments :

 

Python practice programs for beginners- millioninformations


Day 9 Solution:




Day 10:  If-Else statement

In the above, we have used two if statements but we can reduce the number of lines of code by using an else statement.


You can see the number of lines of code decreased. 


The If else get applied in many scenarios.


Day 10 Task:

Get a number from the user and find whether the given number is an odd number or an even number.


Read More

Python practice programs for beginners - Day9

1 comment :

 

Python practice programs for beginners - millioninformations


Day 8 solution:


Program

x and y is False
x or y is True
not x is False
Solution

Day 9:

if statement:

Syntax:

if condition:
    #Statements to be executed once the condition is True

Example:

number=10

if  number>0:
    print("The number is positive")


Output:
   The number is positive


Task:

Try to get two single-digit numbers from the user then add the two numbers and if the addition of those two numbers is above 10 then print "You score greater than 10". If the addition is below 10 then print "You score less than 10".

Will see the solution in next post.









Read More

Python practice programs for beginners - Day8

1 comment :

 

Python practice programs for beginners - millioninformations


Day 7 Solutions:



a=int(input("Enter the number: "))
b=int(input("Enter the number: "))
print(f'{a} is greater than ">" {b} True or False? Result:{a>b}')
print(f'{a} is Lesser than "<" {b} True or False? Result:{a<b}')
print(f'{a} is equals to "==" {b} True or False? Result:{a==b}')
print(f'{a} is not equals to "!=" {b} True or False? Result:{a!=b}')
print(f'{a} is greater than or equals to ">=" {b} True or False? Result:{a>=b}')
print(f'{a} is lesser than or equals to "<=" {b} True or False? Result:{a<=b}')


Output:

Enter the number: 4
Enter the number: 4
4 is greater than ">" 4 True or False? Result: False
4 is Lesser than "<" 4 True or False? Result: False
4 is equal to "==" 4 True or False? Result: True
4 is not equal to "!=" 4 True or False? Result: False
4 is greater than or equals to ">=" 4 True or False? Result: True
4 is lesser than or equals to "<=" 4 True or False? Result: True


Day 8: Logical Operator

Logical Operators helps us to check more than one condition at a time.

we have 3 operators.

and - returns True when both operands return true else false

or - returns True if at least one of the operands is true.

not - returns True if the specified condition is not met.

and Operator:


Example:

a=10

b=10

c=10


a==b and a==c --> True

(True) and (True) --> True

a=11

b=10

c=10

a==b and a==c --> False

(False) and (True) --> False


or Operator:

a=11

b=10

c=10

a==b and a==c --> False

(False) and (True) --> True


not Operator:

not(b==c)

not(True) --> False


Task: Try to use these operators and check various conditions.








Read More