COMMON TERMINOLOGIES IN PYTHON - PART 1
Have you ever gotten into a discussion with a programmer before? Did you find some of the Terminologies mentioned strange or you didn't fully understand them?
In this series, we would be looking at the common Terminologies in python.
It is important to know these Terminologies to be able to professionally/properly explain your codes to people and/or to be able to understand what people say in an instant when these codes are mentioned. Below are a few:
IDLE (Integrated Development and Learning Environment) - this is an environment that allows you to easily write Python code. IDLE can be used to execute a single statements and create, modify, and execute Python scripts.
Python Shell - This is the interactive environment that allows you to type in python code and execute them immediately
System Python - This is the version of python that comes with your operating system
Prompt - usually represented by the symbol ">>>" and it simply means that python is waiting for you to give it some instructions
REPL (Read-Evaluate-Print-Loop) - this refers to the sequence of events in your interactive window in form of a loop (python reads the code inputted>the code is evaluated>output is printed)
Argument - this is a value that is passed to a function when called eg print("Hello World")... "Hello World" is the argument that is being passed.
Function - this is a code that takes some input, known as arguments, processes that input and produces an output called a return value. E.g print("Hello World")... print is the function
Return Value - this is the value that a function returns to the calling script or function when it completes its task (in other words, Output). E.g.
>>> print("Hello World")
Hello World
Where Hello World is your return value.
Note: A return value can be any of these variable types: handle, integer, object, or string
Script - This is a file where you store your python code in a text file and execute all of the code with a single command
Script files - this is a file containing a group of python scripts
Have you ever gotten into a discussion with a programmer before? Did you find some of the Terminologies mentioned strange or you didn't fully understand them?
In this series, we would be looking at the common Terminologies in python.
It is important to know these Terminologies to be able to professionally/properly explain your codes to people and/or to be able to understand what people say in an instant when these codes are mentioned. Below are a few:
IDLE (Integrated Development and Learning Environment) - this is an environment that allows you to easily write Python code. IDLE can be used to execute a single statements and create, modify, and execute Python scripts.
Python Shell - This is the interactive environment that allows you to type in python code and execute them immediately
System Python - This is the version of python that comes with your operating system
Prompt - usually represented by the symbol ">>>" and it simply means that python is waiting for you to give it some instructions
REPL (Read-Evaluate-Print-Loop) - this refers to the sequence of events in your interactive window in form of a loop (python reads the code inputted>the code is evaluated>output is printed)
Argument - this is a value that is passed to a function when called eg print("Hello World")... "Hello World" is the argument that is being passed.
Function - this is a code that takes some input, known as arguments, processes that input and produces an output called a return value. E.g print("Hello World")... print is the function
Return Value - this is the value that a function returns to the calling script or function when it completes its task (in other words, Output). E.g.
>>> print("Hello World")
Hello World
Where Hello World is your return value.
Note: A return value can be any of these variable types: handle, integer, object, or string
Script - This is a file where you store your python code in a text file and execute all of the code with a single command
Script files - this is a file containing a group of python scripts
๐5โค1
Frequently asked Python practice questions and answers in Data Analyst Interview:
1.Temperature Conversion: Write a program that converts a given temperature from Celsius to Fahrenheit or from Fahrenheit to Celsius based on user input.
temp = float(input('Enter the temperature: '))
unit = input('Enter the unit (C/F): ').upper()
if unit == 'C':
converted = (temp * 9/5) + 32
print(f'Temperature in Fahrenheit: {converted}')
elif unit == 'F':
converted = (temp - 32) * 5/9
print(f'Temperature in Celsius: {converted}')
else:
print('Invalid unit')
2.Multiplication Table: Write a program that prints the multiplication table of a given number using a while loop.
num = int(input('Enter a number: '))
i = 1
while i <= 10:
print(f'{num} x {i} = {num * i}')
i += 1
3.Greatest of Three Numbers: Write a program that takes three numbers as input and prints the greatest of the three.
num1 = float(input('Enter first number: '))
num2 = float(input('Enter second number: '))
num3 = float(input('Enter third number: '))
if num1 >= num2 and num1 >= num3:
print(f'The greatest number is {num1}')
elif num2 >= num1 and num2 >= num3:
print(f'The greatest number is {num2}')
else:
print(f'The greatest number is {num3}')
4.Sum of Even Numbers: Write a program that calculates the sum of all even numbers between 1 and a given number using a while loop.
num = int(input('Enter a number: '))
total = 0
i = 2
while i <= num:
total += i
i += 2
print(f'The sum of even numbers up to {num} is {total}')
5.Check Armstrong Number: Write a program that checks if a given number is an Armstrong number.
num = int(input('Enter a number: '))
sum_of_digits = 0
original_num = num
while num > 0:
digit = num % 10
sum_of_digits += digit ** 3
num //= 10
if sum_of_digits == original_num:
print(f'{original_num} is an Armstrong number')
else:
print(f'{original_num} is not an Armstrong number')
6.Reverse a Number: Write a program that reverses the digits of a given number using a while loop.
num = int(input('Enter a number: '))
reversed_num = 0
while num > 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num //= 10
print(f'The reversed number is {reversed_num}')
7.Count Vowels and Consonants: Write a program that counts the number of vowels and consonants in a given string.
string = input('Enter a string: ').lower()
vowels = 'aeiou'
vowel_count = 0
consonant_count = 0
for char in string:
if char.isalpha():
if char in vowels:
vowel_count += 1
else:
consonant_count += 1
print(f'Number of vowels: {vowel_count}')
print(f'Number of consonants: {consonant_count}')
Python Interview Q&A: https://topmate.io/coding/898340
Like for more โค๏ธ
ENJOY LEARNING ๐๐
1.Temperature Conversion: Write a program that converts a given temperature from Celsius to Fahrenheit or from Fahrenheit to Celsius based on user input.
temp = float(input('Enter the temperature: '))
unit = input('Enter the unit (C/F): ').upper()
if unit == 'C':
converted = (temp * 9/5) + 32
print(f'Temperature in Fahrenheit: {converted}')
elif unit == 'F':
converted = (temp - 32) * 5/9
print(f'Temperature in Celsius: {converted}')
else:
print('Invalid unit')
2.Multiplication Table: Write a program that prints the multiplication table of a given number using a while loop.
num = int(input('Enter a number: '))
i = 1
while i <= 10:
print(f'{num} x {i} = {num * i}')
i += 1
3.Greatest of Three Numbers: Write a program that takes three numbers as input and prints the greatest of the three.
num1 = float(input('Enter first number: '))
num2 = float(input('Enter second number: '))
num3 = float(input('Enter third number: '))
if num1 >= num2 and num1 >= num3:
print(f'The greatest number is {num1}')
elif num2 >= num1 and num2 >= num3:
print(f'The greatest number is {num2}')
else:
print(f'The greatest number is {num3}')
4.Sum of Even Numbers: Write a program that calculates the sum of all even numbers between 1 and a given number using a while loop.
num = int(input('Enter a number: '))
total = 0
i = 2
while i <= num:
total += i
i += 2
print(f'The sum of even numbers up to {num} is {total}')
5.Check Armstrong Number: Write a program that checks if a given number is an Armstrong number.
num = int(input('Enter a number: '))
sum_of_digits = 0
original_num = num
while num > 0:
digit = num % 10
sum_of_digits += digit ** 3
num //= 10
if sum_of_digits == original_num:
print(f'{original_num} is an Armstrong number')
else:
print(f'{original_num} is not an Armstrong number')
6.Reverse a Number: Write a program that reverses the digits of a given number using a while loop.
num = int(input('Enter a number: '))
reversed_num = 0
while num > 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num //= 10
print(f'The reversed number is {reversed_num}')
7.Count Vowels and Consonants: Write a program that counts the number of vowels and consonants in a given string.
string = input('Enter a string: ').lower()
vowels = 'aeiou'
vowel_count = 0
consonant_count = 0
for char in string:
if char.isalpha():
if char in vowels:
vowel_count += 1
else:
consonant_count += 1
print(f'Number of vowels: {vowel_count}')
print(f'Number of consonants: {consonant_count}')
Python Interview Q&A: https://topmate.io/coding/898340
Like for more โค๏ธ
ENJOY LEARNING ๐๐
๐3โค1
10 Pandas (python) functions
I used the most as a Data Analyst๐
1/ read_csv(): Reads data from a CSV file.
2/ head(): Displays the first few rows of a df.
3/ info(): Provides metadata about the df.
4/ describe(): Offers statistics.
5/ groupby(): Groups data.
6/ merge(): Combines dfs using a common column.
7/ drop_duplicates(): Removes duplicate rows.
8/ isna(): Checks for missing values.
9/ drop(): Removes specified rows or columns.
10/ apply(): Applies a custom function to df.
Join for more: t.iss.one/pythonanalyst
I used the most as a Data Analyst๐
1/ read_csv(): Reads data from a CSV file.
2/ head(): Displays the first few rows of a df.
3/ info(): Provides metadata about the df.
4/ describe(): Offers statistics.
5/ groupby(): Groups data.
6/ merge(): Combines dfs using a common column.
7/ drop_duplicates(): Removes duplicate rows.
8/ isna(): Checks for missing values.
9/ drop(): Removes specified rows or columns.
10/ apply(): Applies a custom function to df.
Join for more: t.iss.one/pythonanalyst
๐10
You don't need to know everything about every data tool. Focus on what will help land you your job.
For Excel:
- IFS (all variations)
- XLOOKUP
- IMPORTRANGE (in GSheets)
- Pivot Tables
- Dynamic functions like TODAY()
For SQL:
- Sum
- Group By
- Window Functions
- CTEs
- Joins
For Tableau:
- Calculated Columns
- Sets
- Groups
- Formatting
For Power BI:
- Power Query for data transformation
- DAX (Data Analysis Expressions) for creating custom calculations
- Relationships between tables
- Creating interactive and dynamic dashboards
- Utilizing slicers and filters effectively
I have created 100-Day Roadmap & Resources for Data Analyst ๐๐
https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02
Hope it helps :)
For Excel:
- IFS (all variations)
- XLOOKUP
- IMPORTRANGE (in GSheets)
- Pivot Tables
- Dynamic functions like TODAY()
For SQL:
- Sum
- Group By
- Window Functions
- CTEs
- Joins
For Tableau:
- Calculated Columns
- Sets
- Groups
- Formatting
For Power BI:
- Power Query for data transformation
- DAX (Data Analysis Expressions) for creating custom calculations
- Relationships between tables
- Creating interactive and dynamic dashboards
- Utilizing slicers and filters effectively
I have created 100-Day Roadmap & Resources for Data Analyst ๐๐
https://whatsapp.com/channel/0029VaGgzAk72WTmQFERKh02
Hope it helps :)
โค6๐4
30-day roadmap to learn Python up to an intermediate level
Week 1: Python Basics
*Day 1-2:*
- Learn about Python, its syntax, and how to install Python on your computer.
- Write your first "Hello, World!" program.
- Understand variables and data types (integers, floats, strings).
*Day 3-4:*
- Explore basic operations (arithmetic, string concatenation).
- Learn about user input and how to use the
- Practice creating and using variables.
*Day 5-7:*
- Dive into control flow with if statements, else statements, and loops (for and while).
- Work on simple programs that involve conditions and loops.
Week 2: Functions and Modules
*Day 8-9:*
- Study functions and how to define your own functions using
- Learn about function arguments and return values.
*Day 10-12:*
- Explore built-in functions and libraries (e.g.,
- Understand how to import modules and use their functions.
*Day 13-14:*
- Practice writing functions for common tasks.
- Create a small project that utilizes functions and modules.
Week 3: Data Structures
*Day 15-17:*
- Learn about lists and their operations (slicing, appending, removing).
- Understand how to work with lists of different data types.
*Day 18-19:*
- Study dictionaries and their key-value pairs.
- Practice manipulating dictionary data.
*Day 20-21:*
- Explore tuples and sets.
- Understand when and how to use each data structure.
Week 4: Intermediate Topics
*Day 22-23:*
- Study file handling and how to read/write files in Python.
- Work on projects involving file operations.
*Day 24-26:*
- Learn about exceptions and error handling.
- Explore object-oriented programming (classes and objects).
*Day 27-28:*
- Dive into more advanced topics like list comprehensions and generators.
- Study Python's built-in libraries for web development (e.g., requests).
*Day 29-30:*
- Explore additional libraries and frameworks relevant to your interests (e.g., NumPy for data analysis, Flask for web development, or Pygame for game development).
- Work on a more complex project that combines your knowledge from the past weeks.
Throughout the 30 days, practice coding daily, and don't hesitate to explore Python's documentation and online resources for additional help. You can refer this guide to help you with interview preparation.
Good luck with your Python journey ๐๐
Week 1: Python Basics
*Day 1-2:*
- Learn about Python, its syntax, and how to install Python on your computer.
- Write your first "Hello, World!" program.
- Understand variables and data types (integers, floats, strings).
*Day 3-4:*
- Explore basic operations (arithmetic, string concatenation).
- Learn about user input and how to use the
input()
function.- Practice creating and using variables.
*Day 5-7:*
- Dive into control flow with if statements, else statements, and loops (for and while).
- Work on simple programs that involve conditions and loops.
Week 2: Functions and Modules
*Day 8-9:*
- Study functions and how to define your own functions using
def
.- Learn about function arguments and return values.
*Day 10-12:*
- Explore built-in functions and libraries (e.g.,
len()
, random
, math
).- Understand how to import modules and use their functions.
*Day 13-14:*
- Practice writing functions for common tasks.
- Create a small project that utilizes functions and modules.
Week 3: Data Structures
*Day 15-17:*
- Learn about lists and their operations (slicing, appending, removing).
- Understand how to work with lists of different data types.
*Day 18-19:*
- Study dictionaries and their key-value pairs.
- Practice manipulating dictionary data.
*Day 20-21:*
- Explore tuples and sets.
- Understand when and how to use each data structure.
Week 4: Intermediate Topics
*Day 22-23:*
- Study file handling and how to read/write files in Python.
- Work on projects involving file operations.
*Day 24-26:*
- Learn about exceptions and error handling.
- Explore object-oriented programming (classes and objects).
*Day 27-28:*
- Dive into more advanced topics like list comprehensions and generators.
- Study Python's built-in libraries for web development (e.g., requests).
*Day 29-30:*
- Explore additional libraries and frameworks relevant to your interests (e.g., NumPy for data analysis, Flask for web development, or Pygame for game development).
- Work on a more complex project that combines your knowledge from the past weeks.
Throughout the 30 days, practice coding daily, and don't hesitate to explore Python's documentation and online resources for additional help. You can refer this guide to help you with interview preparation.
Good luck with your Python journey ๐๐
๐10
๐ Data Analyst vs Business Analyst: Quick comparison ๐
1. Data Analyst: Dives into data, cleans it up, and finds hidden insights like Sherlock Holmes. ๐ต๏ธโโ๏ธ
Business Analyst: Talks to stakeholders, defines requirements, and ensures everyoneโs on the same page. The diplomat. ๐ค
2. Data Analyst: Master of Excel, SQL, Python, and dashboards. Their life is rows, columns, and code. ๐
Business Analyst: Fluent in meetings, presentations, and documentation. Their life is all about people and processes. ๐๏ธ
3. Data Analyst: Focuses on numbers, patterns, and trends to tell a story with data. ๐
Business Analyst: Focuses on the "why" behind the numbers to help the business make decisions. ๐ก
4. Data Analyst: Creates beautiful Power BI or Tableau dashboards that wow stakeholders. ๐จ
Business Analyst: Uses those dashboards to present actionable insights to the C-suite. ๐ค
5. Data Analyst: SQL queries, Python scripts, and statistical models are their weapons. ๐ ๏ธ
Business Analyst: Process diagrams, requirement docs, and communication are their superpowers. ๐ฆธโโ๏ธ
6. Data Analyst: โWhy is revenue declining? Let me analyze the sales data.โ
Business Analyst: โWhy is revenue declining? Letโs talk to the sales team and fix the process.โ
7. Data Analyst: Works behind the scenes, crunching data and making sense of numbers. ๐ข
Business Analyst: Works with teams to ensure that processes, strategies, and technologies align with business goals. ๐ฏ
8. Data Analyst: Uses data to make decisionsโraw data is their best friend. ๐
Business Analyst: Uses data to support business decisions and recommends solutions to improve processes. ๐
9. Data Analyst: Aims for accuracy, precision, and statistical significance in every analysis. ๐งฎ
Business Analyst: Aims to understand business needs, optimize workflows, and align solutions with business objectives. ๐ข
10. Data Analyst: Focuses on extracting insights from data for current or historical analysis. ๐
Business Analyst: Looks forward, aligning business strategies with long-term goals and improvements. ๐ฑ
Both roles are vital, but they approach the data world in their unique ways.
Like this post for more content like this ๐โฅ๏ธ
Share with credits: https://t.iss.one/sqlspecialist
Hope it helps :)
1. Data Analyst: Dives into data, cleans it up, and finds hidden insights like Sherlock Holmes. ๐ต๏ธโโ๏ธ
Business Analyst: Talks to stakeholders, defines requirements, and ensures everyoneโs on the same page. The diplomat. ๐ค
2. Data Analyst: Master of Excel, SQL, Python, and dashboards. Their life is rows, columns, and code. ๐
Business Analyst: Fluent in meetings, presentations, and documentation. Their life is all about people and processes. ๐๏ธ
3. Data Analyst: Focuses on numbers, patterns, and trends to tell a story with data. ๐
Business Analyst: Focuses on the "why" behind the numbers to help the business make decisions. ๐ก
4. Data Analyst: Creates beautiful Power BI or Tableau dashboards that wow stakeholders. ๐จ
Business Analyst: Uses those dashboards to present actionable insights to the C-suite. ๐ค
5. Data Analyst: SQL queries, Python scripts, and statistical models are their weapons. ๐ ๏ธ
Business Analyst: Process diagrams, requirement docs, and communication are their superpowers. ๐ฆธโโ๏ธ
6. Data Analyst: โWhy is revenue declining? Let me analyze the sales data.โ
Business Analyst: โWhy is revenue declining? Letโs talk to the sales team and fix the process.โ
7. Data Analyst: Works behind the scenes, crunching data and making sense of numbers. ๐ข
Business Analyst: Works with teams to ensure that processes, strategies, and technologies align with business goals. ๐ฏ
8. Data Analyst: Uses data to make decisionsโraw data is their best friend. ๐
Business Analyst: Uses data to support business decisions and recommends solutions to improve processes. ๐
9. Data Analyst: Aims for accuracy, precision, and statistical significance in every analysis. ๐งฎ
Business Analyst: Aims to understand business needs, optimize workflows, and align solutions with business objectives. ๐ข
10. Data Analyst: Focuses on extracting insights from data for current or historical analysis. ๐
Business Analyst: Looks forward, aligning business strategies with long-term goals and improvements. ๐ฑ
Both roles are vital, but they approach the data world in their unique ways.
Like this post for more content like this ๐โฅ๏ธ
Share with credits: https://t.iss.one/sqlspecialist
Hope it helps :)
๐6๐2
Python Interview Questions for data analyst interview
Question 1: Find the top 5 dates when the percentage change in Company A's stock price was the highest.
Question 2: Calculate the annualized volatility of Company B's stock price. (Hint: Annualized volatility is the standard deviation of daily returns multiplied by the square root of the number of trading days in a year.)
Question 3: Identify the longest streaks of consecutive days when the stock price of Company A was either increasing or decreasing continuously.
Question 4: Create a new column that represents the cumulative returns of Company A's stock price over the year.
Question 5: Calculate the 7-day rolling average of both Company A's and Company B's stock prices and find the date when the two rolling averages were closest to each other.
Question 6: Create a new DataFrame that contains only the dates when Company A's stock price was above its 50-day moving average, and Company B's stock price was below its 50-day moving average
Hope you'll like it
Like this post if you need more resources like this ๐โค๏ธ
#Python
Question 1: Find the top 5 dates when the percentage change in Company A's stock price was the highest.
Question 2: Calculate the annualized volatility of Company B's stock price. (Hint: Annualized volatility is the standard deviation of daily returns multiplied by the square root of the number of trading days in a year.)
Question 3: Identify the longest streaks of consecutive days when the stock price of Company A was either increasing or decreasing continuously.
Question 4: Create a new column that represents the cumulative returns of Company A's stock price over the year.
Question 5: Calculate the 7-day rolling average of both Company A's and Company B's stock prices and find the date when the two rolling averages were closest to each other.
Question 6: Create a new DataFrame that contains only the dates when Company A's stock price was above its 50-day moving average, and Company B's stock price was below its 50-day moving average
Hope you'll like it
Like this post if you need more resources like this ๐โค๏ธ
#Python
๐3โค1