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 ๐๐
๐2
๐๐ฅ๐๐ ๐๐ผ๐ผ๐ด๐น๐ฒ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด ๐ฃ๐ฎ๐๐ต! ๐๐ฒ๐ฐ๐ผ๐บ๐ฒ ๐ฎ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฒ๐ฑ ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ ๐ถ๐ป ๐ฎ๐ฌ๐ฎ๐ฑ๐
If youโre dreaming of starting a high-paying data career or switching into the booming tech industry, Google just made it a whole lot easier โ and itโs completely FREE๐จโ๐ป
๐๐ข๐ง๐ค๐:-
https://pdlink.in/4cMx2h2
Youโll get access to hands-on labs, real datasets, and industry-grade training created directly by Googleโs own experts๐ป
If youโre dreaming of starting a high-paying data career or switching into the booming tech industry, Google just made it a whole lot easier โ and itโs completely FREE๐จโ๐ป
๐๐ข๐ง๐ค๐:-
https://pdlink.in/4cMx2h2
Youโll get access to hands-on labs, real datasets, and industry-grade training created directly by Googleโs own experts๐ป
๐2
๐ฏ ๐๐ฟ๐ฒ๐ฒ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐ฌ๐ผ๐ ๐ ๐๐๐ ๐ง๐ฎ๐ธ๐ฒ ๐ถ๐ป ๐ฎ๐ฌ๐ฎ๐ฑ ๐๐ผ ๐๐ผ๐ผ๐๐ ๐ฌ๐ผ๐๐ฟ ๐ฅ๐ฒ๐๐๐บ๐ฒ ๐ฎ๐ป๐ฑ ๐๐ฎ๐ป๐ฑ ๐ง๐ผ๐ฝ ๐ง๐ฒ๐ฐ๐ต ๐๐ผ๐ฏ๐!๐
In a world full of competition, your skills will set you apart โ not just your degree๐จโ๐๐
Here are 3 powerful courses you MUST take if you want to seriously boost your resume and catch the eyes of recruiters from Google, Amazon, Microsoft, and other top companies๐ป๐ข
๐๐ข๐ง๐ค๐:-
https://pdlink.in/3EILdaj
Enjoy Learning โ ๏ธ
In a world full of competition, your skills will set you apart โ not just your degree๐จโ๐๐
Here are 3 powerful courses you MUST take if you want to seriously boost your resume and catch the eyes of recruiters from Google, Amazon, Microsoft, and other top companies๐ป๐ข
๐๐ข๐ง๐ค๐:-
https://pdlink.in/3EILdaj
Enjoy Learning โ ๏ธ
๐1
Learning Python in 2025 is like discovering a treasure chest ๐ full of magical powers! Here's why it's valuable:
1. Versatility ๐: Python is used in web development, data analysis, artificial intelligence, machine learning, automation, and more. Whatever your interest, Python has an option for it.
2. Ease of Learning ๐: Python's syntax is as clear as a sunny day!โ๏ธ Its simple and readable syntax makes it beginner-friendly, perfect for aspiring programmers of all levels.
3. Community Support ๐ค: Python has a vast community of programmers ready to help! Whether you're stuck on a problem or looking for guidance, there are countless forums, tutorials, and resources to tap into.
4. Job Opportunities ๐ผ: Companies are constantly seeking Python wizards to join their ranks! From tech giants to startups, the demand for Python skills is abundant.๐ฅ
5. Future-proofing ๐ฎ: With its widespread adoption and continuous growth, learning Python now sets you up for success in the ever-evolving world of tech.
6. Fun Projects ๐: Python makes coding feel like brewing potions! From creating games ๐ฎ to building robots ๐ค, the possibilities are endless.
So grab your keyboard and embark on a Python adventure! It's not just learning a language, it's unlocking a world of endless possibilities.
1. Versatility ๐: Python is used in web development, data analysis, artificial intelligence, machine learning, automation, and more. Whatever your interest, Python has an option for it.
2. Ease of Learning ๐: Python's syntax is as clear as a sunny day!โ๏ธ Its simple and readable syntax makes it beginner-friendly, perfect for aspiring programmers of all levels.
3. Community Support ๐ค: Python has a vast community of programmers ready to help! Whether you're stuck on a problem or looking for guidance, there are countless forums, tutorials, and resources to tap into.
4. Job Opportunities ๐ผ: Companies are constantly seeking Python wizards to join their ranks! From tech giants to startups, the demand for Python skills is abundant.๐ฅ
5. Future-proofing ๐ฎ: With its widespread adoption and continuous growth, learning Python now sets you up for success in the ever-evolving world of tech.
6. Fun Projects ๐: Python makes coding feel like brewing potions! From creating games ๐ฎ to building robots ๐ค, the possibilities are endless.
So grab your keyboard and embark on a Python adventure! It's not just learning a language, it's unlocking a world of endless possibilities.
๐1
๐ง๐๐ฆ ๐๐ฅ๐๐ ๐๐ฒ๐ฟ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป ๐ข๐ป ๐๐ฎ๐๐ฎ ๐ ๐ฎ๐ป๐ฎ๐ด๐ฒ๐บ๐ฒ๐ป๐ - ๐๐ป๐ฟ๐ผ๐น๐น ๐๐ผ๐ฟ ๐๐ฅ๐๐๐
Want to know how top companies handle massive amounts of data without losing track? ๐
TCS is offering a FREE beginner-friendly course on Master Data Management, and yesโit comes with a certificate! ๐
๐๐ข๐ง๐ค๐:-
https://pdlink.in/4jGFBw0
Just click and start learning!โ ๏ธ
Want to know how top companies handle massive amounts of data without losing track? ๐
TCS is offering a FREE beginner-friendly course on Master Data Management, and yesโit comes with a certificate! ๐
๐๐ข๐ง๐ค๐:-
https://pdlink.in/4jGFBw0
Just click and start learning!โ ๏ธ
โค2