Advance your career with in-demand skills
Receive professional-level training from Microsoft
Demonstrate your technical proficiency
Earn an employer-recognized certificate from Microsoft
Prepare for an industry certification exam
Python Coding January 24, 2024 Coursera, Data Science No comments
Receive professional-level training from Microsoft
Demonstrate your technical proficiency
Earn an employer-recognized certificate from Microsoft
Prepare for an industry certification exam
Python Coding January 24, 2024 Coursera, Data Science No comments
How to perform data engineering with Azure Synapse Apache Spark Pools to boost the performance of big-data analytic applications
How to ingest data using Apache Spark Notebooks in Azure Synapse Analytics
How to transform data using DataFrames in Apache Spark Pools in Azure Synapse Analytics
How to monitor and manage data engineering workloads with Apache Spark in Azure Synapse Analytics
Python Coding January 24, 2024 Coursera, Machine Learning No comments
How to plan and create a working environment for data science workloads on Azure
How to run data experiments and train predictive models
Python Coding January 23, 2024 Python Coding Challenge No comments
def test(i, j):
if i == 0:
return j
else:
return test(i - 1, i + j)
print(test(2, 5))
Python Coding January 23, 2024 Coursera No comments
Design and analyze experiments where some of the factors are random
Design and analyze experiments where there are nested factors or hard-to-change factors
Analyze experiments with covariates
Design and analyze experiments with nonnormal response distributions
Python Coding January 23, 2024 Coursera No comments
Conduct experiments w/computer models and understand how least squares regression is used to build an empirical model from experimental design data
Understand the response surface methodology strategy to conduct experiments where system optimization is the objective
Recognize how the response surface approach can be used for experiments where the factors are the components of a mixture
Recognize where the objective of the experiment is to minimize the variability transmitted into the response from uncontrollable factors
Python Coding January 23, 2024 Coursera, Factorial No comments
Conduct a factorial experiment in blocks and construct and analyze a fractional factorial design
Apply the factorial concept to experiments with several factors
Use the analysis of variance for factorial designs
Use the 2^k system of factorial designs
Python Coding January 23, 2024 Coursera, Data Science No comments
By the end of this course, you will be able to:
Approach complex industrial and business research problems and address them through a rigorous, statistically sound experimental strategy
Use modern software to effectively plan experiments
Analyze the resulting data of an experiment, and communicate the results effectively to decision-makers.
Python Coding January 23, 2024 Coursera, Data Science No comments
Plan, design and conduct experiments efficiently and effectively, and analyze the resulting data to obtain valid objective conclusions.
Use response surface methods for system optimization as a follow-up to successful screening.
Use experimental design tools for computer experiments, both deterministic and stochastic computer models.
Use software tools to create custom designs based on optimal design methodology for situations where standard designs are not easily applicable.
Python Coding January 22, 2024 Course, Coursera, Python No comments
There are 7 modules in this course
Behind every mouse click and touch-screen tap, there is a computer program that makes things happen. This course introduces the fundamental building blocks of programming and teaches you how to write fun and useful programs using the Python language.
Python Coding January 22, 2024 Python Coding Challenge No comments
Python Coding January 21, 2024 Python Coding Challenge No comments
The above code uses the symmetric difference operator (^) between two sets. The symmetric difference of two sets is the set of elements that are in either of the sets, but not in both.
Here's the output of the given code:
set1 = {1, 1, 2}
set2 = {2, 3, 4}
result = set1 ^ set2
print(result)
Output:
{1, 3, 4}
In the result set, you can see that it contains elements 1, 3, and 4, which are present in either set1 or set2 but not in both. Additionally, duplicate elements are automatically removed in a set, so even though set1 contains two occurrences of the element 1, it appears only once in the result set.
Python Coding January 21, 2024 Books, Python No comments
Quick solutions to frequently asked algorithm and data structure questions.
Key Features
● Learn how to crack the Data structure and Algorithms Code test using the top 75 questions/solutions discussed in the book.
● Refresher on Python data structures and writing clean, actionable python codes.
● Simplified solutions on translating business problems into executable programs and applications.
Description
Python is the most popular programming language, and hence, there is a huge demand for Python programmers. Even if you have learnt Python or have done projects on AI, you cannot enter the top companies unless you have cleared the Algorithms and data Structure coding test.
This book presents 75 most frequently asked coding questions by top companies of the world. It not only focuses on the solution strategy, but also provides you with the working code. This book will equip you with the skills required for developing and analyzing algorithms for various situations. This book teaches you how to measure Time Complexity, it then provides solutions to questions on the Linked list, Stack, Hash table, and Math. Then you can review questions and solutions based on graph theory and application techniques. Towards the end, you will come across coding questions on advanced topics such as Backtracking, Greedy, Divide and Conquer, and Dynamic Programming.
After reading this book, you will successfully pass the python interview with high confidence and passion for exploring python in future.
What you will learn
● Design an efficient algorithm to solve the problem.
● Learn to use python tricks to make your program competitive.
● Learn to understand and measure time and space complexity.
● Get solutions to questions based on Searching, Sorting, Graphs, DFS, BFS, Backtracking, Dynamic programming.
Who this book is for
This book will help professionals and beginners clear the Data structures and Algorithms coding test. Basic knowledge of Python and Data Structures is a must.
Table of Contents
1. Lists, binary search and strings
2. Linked lists and stacks
3. Hash table and maths
4. Trees and graphs
5. Depth first search
6. Breadth first search
7. Backtracking
8. Greedy and divide and conquer algorithms
9. Dynamic programming
About the Author
Professor Shyamkant Limaye spent 18 years in the computer industry and 30 years in teaching electronics engineering students. His experience includes a two-year stint as a system analyst in the USA. In 1971, he graduated from Visvesvaraya National Institute of Technology in Electrical Engineering with a gold medal. He did masters from IIT Kanpur and Doctorate in electronics from RTM Nagpur University. He has guided ten students for PhD. He published a text book on VHDL programming in 2007. He has also published a thriller novel titled “Dual reality” in 2011. Currently, he is a Professor in the Electronics and Telecomm Department at St. Vincent Pallotti College of Engineering and Technology, Nagpur.
Python Coding January 20, 2024 Python No comments
Python Coding January 20, 2024 Python Coding Challenge No comments
Question 1:
What is a dictionary in Python?
a) A collection of ordered elements
b) A collection of unordered elements
c) A single element
d) A data type
Question 2:
How do you create an empty dictionary in Python?
a) empty_dict = {}
b) empty_dict = dict()
c) empty_dict = new dict()
d) Both a and b
Question 3:
How do you access the value associated with a specific key in a dictionary?
a) dictionary.value(key)
b) dictionary[key]
c) dictionary.get(key)
d) dictionary.retrieve(key)
Question 4:
What is the purpose of the len() function when used with a dictionary?
a) It returns the total number of key-value pairs in the dictionary
b) It returns the last key in the dictionary
c) It returns the length of each value in the dictionary
d) It returns the sum of all values in the dictionary
Question 5:
How do you add a new key-value pair to a dictionary?
a) dictionary.add(key, value)
b) dictionary[key] = value
c) dictionary.insert(key, value)
d) dictionary.append(key, value)
Question 6:
What is the key difference between a dictionary and a list in Python?
a) Dictionaries are ordered, while lists are unordered
b) Dictionaries are mutable, while lists are immutable
c) Dictionaries can contain only numeric elements
d) Dictionaries are unordered and do not allow duplicate keys
Question 7:
How do you check if a key is present in a dictionary?
a) key in dictionary
b) dictionary.contains(key)
c) dictionary.exists(key)
d) key.exists(dictionary)
Question 8:
What does the dictionary.keys() method return?
a) The values of the dictionary
b) The keys of the dictionary
c) The key-value pairs of the dictionary
d) The length of the dictionary
Question 9:
How do you remove a key-value pair from a dictionary?
a) dictionary.remove(key)
b) dictionary.discard(key)
c) dictionary.delete(key)
d) All of the above
Question 10:
Which method is used to retrieve the value associated with a key, and if the key is not present, it returns a default value?
a) dictionary.get(key, default)
b) dictionary.retrieve(key, default)
c) dictionary.value(key, default)
d) dictionary.fetch(key, default)
Question 11:
What is the purpose of the pop() method in Python dictionaries?
a) Adds an element to the dictionary
b) Removes the last element from the dictionary and returns its value
c) Removes the first occurrence of the specified element
d) Removes the key-value pair for a specified key
Question 12:
How do you update the value associated with a key in a dictionary?
a) dictionary.update(key, new_value)
b) dictionary[key] = new_value
c) dictionary.modify(key, new_value)
d) dictionary.change_value(key, new_value)
Question 13:
What is the output of the following code?
my_dict = {"a": 1, "b": 2, "c": 3}
del my_dict["b"]
print(my_dict)
a) {"a": 1, "b": 2, "c": 3}
b) {"a": 1, "c": 3}
c) {"a": 1, "b": 2}
d) Raises an error
Question 14:
How do you iterate over the keys of a dictionary?
a) for key in dictionary.keys():
b) for key in dictionary:
c) for key in dictionary.values():
d) for key in dictionary.items():
Question 15:
What is the purpose of the values() method in Python dictionaries?
a) Returns the keys of the dictionary
b) Returns the values of the dictionary
c) Returns the key-value pairs of the dictionary
d) Returns the length of the dictionary
Question 16:
Which method is used to clear all key-value pairs from a dictionary?
a) dictionary.clear()
b) dictionary.remove_all()
c) dictionary.delete()
d) dictionary.empty()
Question 17:
What is the purpose of the items() method in Python dictionaries?
a) Returns the keys of the dictionary
b) Returns the values of the dictionary
c) Returns the key-value pairs of the dictionary
d) Returns the length of the dictionary
Question 18:
What is the output of the following code?
my_dict = {"apple": 3, "banana": 5, "cherry": 2}
sorted_dict = dict(sorted(my_dict.items()))
print(sorted_dict)
a) {"apple": 3, "banana": 5, "cherry": 2}
b) {"cherry": 2, "apple": 3, "banana": 5}
c) {"banana": 5, "apple": 3, "cherry": 2}
d) Raises an error
Question 19:
How do you create a dictionary with keys as numbers from 1 to 5 and values as their squares?
a) squares = {i: i ** 2 for i in range(1, 6)}
b) squares = {i: i * i for i in range(1, 6)}
c) squares = {i: i ** 2 for i in [1, 2, 3, 4, 5]}
d) All of the above
Question 20:
What is the purpose of the copy() method in Python dictionaries?
a) Creates a shallow copy of the dictionary
b) Creates a deep copy of the dictionary
c) Returns the reversed dictionary
d) Appends a copy of the dictionary to itself
Python Coding January 20, 2024 Python Coding Challenge No comments
Question 1:
What is a set in Python?
a) A collection of ordered elements
b) A collection of unordered elements
c) A single element
d) A data type
Question 2:
How do you create an empty set in Python?
a) set()
b) empty_set = {}
c) empty_set = set()
d) Both b and c
Question 3:
How do you add an element to a set in Python?
a) set.insert(element)
b) set.add(element)
c) set.append(element)
d) set.include(element)
Question 4:
What is the key difference between a set and a list in Python?
a) Sets are ordered, while lists are unordered
b) Sets are mutable, while lists are immutable
c) Sets can contain only numeric elements
d) Sets are unordered and do not allow duplicate elements
Question 5:
How do you check if an element is present in a set?
a) element in set
b) set.contains(element)
c) set.exists(element)
d) element.exists(set)
Question 6:
What happens when you try to add a duplicate element to a set?
a) The element is added successfully
b) Python raises an exception
c) The duplicate element is ignored, and the set remains unchanged
d) The set is automatically sorted
Question 7:
How do you remove an element from a set?
a) set.remove(element)
b) set.delete(element)
c) set.pop(element)
d) set.discard(element)
Question 8:
What is the purpose of the len() function when used with a set?
a) It returns the total number of elements in the set
b) It returns the last element of the set
c) It returns the length of each element in the set
d) It returns the sum of all elements in the set
Question 9:
How do you create a set with elements from 1 to 5 in Python?
a) set = {1, 2, 3, 4, 5}
b) set = range(1, 6)
c) set = set(1, 6)
d) set = {range(1, 6)}
Question 10:
What is the purpose of the pop() method in Python sets?
a) Removes the last element from the set
b) Removes a random element from the set and returns it
c) Removes the first occurrence of the specified element
d) Sorts the elements of the set
Question 11:
What is the difference between a set and a frozenset in Python?
a) Sets are mutable, while frozensets are immutable
b) Sets are unordered, while frozensets are ordered
c) Sets can contain only numeric elements
d) Sets allow duplicate elements, while frozensets do not
Question 12:
Which of the following statements is true regarding the union of two sets?
a) The union operator for sets is +
b) The union of two sets is the intersection of their elements
c) The union of two sets contains all unique elements from both sets
d) The union of two sets results in an empty set
Question 13:
What is the purpose of the clear() method in Python sets?
a) Clears all elements from the set
b) Returns a clear copy of the set
c) Clears only the first element from the set
d) Clears the set if a specific element is provided
Question 14:
Which method is used to find the intersection of two sets in Python?
a) set.intersection(set2)
b) set.intersect(set2)
c) set.common(set2)
d) set.and(set2)
Question 15:
What is the output of the following code?
set1 = {1, 2, 3}
set2 = {3, 4, 5}
result = set1.union(set2)
print(result)
a) {1, 2, 3, 4, 5}
b) {1, 2, 3}
c) {3, 4, 5}
d) {1, 2, 4, 5}
Question 16:
How do you check if a set is a subset of another set?
a) set.is_subset(other_set)
b) set.subset_of(other_set)
c) set.issubset(other_set)
d) set.contains_subset(other_set)
Question 17:
What does the difference() method do when applied to two sets?
a) Returns the union of the two sets
b) Returns the intersection of the two sets
c) Returns the difference between the two sets
d) Returns the symmetric difference between the two sets
Question 18:
What is the purpose of the symmetric_difference() method in Python sets?
a) Returns the union of the two sets
b) Returns the intersection of the two sets
c) Returns the difference between the two sets
d) Returns the symmetric difference between the two sets
Question 19:
What is the output of the following code?
set1 = {1, 2, 3}
set2 = {3, 4, 5}
result = set1.difference(set2)
print(result)
a) {1, 2, 3, 4, 5}
b) {1, 2}
c) {3}
d) {4, 5}
Question 20:
What is the purpose of the issuperset() method in Python sets?
a) Checks if the set is a proper superset of another set
b) Checks if the set is a subset of another set
c) Checks if the set is equal to another set
d) Checks if the set contains all elements of another set
Python Coding January 19, 2024 Books No comments
This is the eBook of the printed book and may not include any media, website access codes, or print supplements that may come packaged with the bound book.
Introducing Microsoft Power BI enables you to evaluate when and how to use Power BI. Get inspired to improve business processes in your company by leveraging the available analytical and collaborative features of this environment.
Be sure to watch for the publication of Alberto Ferrari and Marco Russo's upcoming retail book, Analyzing Data with Power BI and Power Pivot for Excel (ISBN 9781509302765).
Python Coding January 19, 2024 BI, Coursera No comments
Create Relationship in PowerBI
Create Visualization in PowerBI
Publish a report in powerbi service
Python Coding January 19, 2024 BI, Coursera No comments
Prepare and Clean Data using Power BI
Transform and Load Data using Power BI
Python Coding January 19, 2024 BI, Coursera No comments
Build an Income statement dashboard in Power BI
Visualize the income statement using cards, table and column charts
Transform & clean data in the Power Query editor
Python Coding January 19, 2024 BI, Coursera No comments
Build an attractive and interactive sales dashboard with all the necessary visualizations in a black and blue theme
Visualize sales data using bar charts & pie charts
Create interactive maps to visualize sales data by countries and markets
Python Coding January 19, 2024 BI, Coursera No comments
Build an attractive and eye-catching HR dashboard
Visualize gender & racial diversity using graphs & charts in Power BI
Explore buttons, themes, filters & slicers to make the dashboard interactive & smart
Python Coding January 19, 2024 BI, Coursera No comments
New Power BI users will begin the course by gaining a conceptual understanding of the Power BI desktop application and the Power BI service. Learners will explore the Power BI interface while learning how to manage pages and understand the basics of visualizations. Learners can download a course dataset and engage in numerous hands-on experiences to discover how to import, connect, clean, transform, and model their own data in the Power BI desktop application.
Learners will investigate reports, learn about workspaces, and practice viewing, creating, and publishing reports to the Power BI service. Finally, learners will become proficient in the creation and utilization dashboards.
Python Coding January 19, 2024 No comments
Navigate and understand the process of importing data into Power Bi.
Use Power Query to clean data before constructing visuals and reports. Determine relationships between data and use reference tables in Power Bi.
Create and design a reporting dashboard with dynamic features. Publish and share your report
Python Coding January 19, 2024 BI, Coursera No comments
Build a Dashboard in Power BI by building a report and visuals.
Build a report with visuals.
Create a dashboard and pin visuals.
Python Coding January 19, 2024 BI, Coursera No comments
Import and Transform Data with Power BI Desktop
Visualize Data with Power BI Desktop
Python Coding January 19, 2024 Python Coding Challenge No comments
What is a tuple in Python?
a) A collection of unordered elements
b) A collection of ordered elements
c) A single element
d) A data type
Question 2:
How do you create an empty tuple in Python?
a) tuple()
b) empty_tuple = ()
c) empty_tuple = tuple()
d) Both b and c
Question 3:
How do you access the first element of a tuple?
a) tuple[0]
b) tuple.first()
c) tuple.first
d) tuple.get(0)
Question 4:
Which of the following statements is used to add an element to a tuple?
a) tuple.insert(0, element)
b) Tuples are immutable, so elements cannot be added once a tuple is created
c) tuple.add(element)
d) tuple.extend(element)
Question 5:
What is the key difference between a tuple and a list in Python?
a) Tuples are mutable, while lists are immutable
b) Tuples are ordered, while lists are unordered
c) Tuples are immutable, while lists are mutable
d) Tuples can contain only numeric elements
Question 6:
How do you check if an element is present in a tuple?
a) element in tuple
b) tuple.contains(element)
c) tuple.exists(element)
d) element.exists(tuple)
Question 7:
What does the tuple.count(element) method do?
a) Counts the total number of elements in the tuple
b) Counts the occurrences of a specific element in the tuple
c) Counts the sum of all elements in the tuple
d) Counts the average value of elements in the tuple
Question 8:
How do you concatenate two tuples in Python?
a) tuple1 + tuple2
b) tuple1.concat(tuple2)
c) concat(tuple1, tuple2)
d) combine(tuple1, tuple2)
Question 9:
How do you create a tuple with a single element?
a) single_tuple = (1)
b) single_tuple = 1,
c) single_tuple = (1,)
d) Both a and b
Question 10:
Which method is used to find the index of the first occurrence of a specified element in a tuple?
a) tuple.index(element)
b) tuple.find(element)
c) tuple.search(element)
d) tuple.loc(element)
Question 11:
What happens when you try to modify an element in a tuple?
a) It is not possible to modify elements in a tuple as they are immutable
b) The element is updated successfully
c) Python raises an exception
d) The element is deleted from the tuple
Question 12:
How do you create a tuple with elements from 1 to 5 in Python?
a) tuple = (1, 2, 3, 4, 5)
b) tuple = range(1, 6)
c) tuple = tuple(1, 6)
d) tuple = (range(1, 6))
Question 13:
What is the purpose of the len() function when used with a tuple?
a) It returns the total number of elements in the tuple
b) It returns the last element of the tuple
c) It returns the length of each element in the tuple
d) It returns the sum of all elements in the tuple
Question 14:
How do you check if two tuples are equal?
a) tuple1.is_equal(tuple2)
b) tuple1 == tuple2
c) tuple1.equals(tuple2)
d) tuple1.equals(tuple2, strict=True)
Question 15:
What is the purpose of the max() function when used with a tuple?
a) It returns the maximum element in the tuple
b) It returns the index of the maximum element in the tuple
c) It returns the sum of all elements in the tuple
d) It returns the average value of elements in the tuple
Question 16:
Which method is used to remove the last element from a tuple?
a) tuple.remove_last()
b) tuple.pop()
c) tuple.delete_last()
d) Tuples are immutable, so elements cannot be removed
Question 17:
How do you convert a list to a tuple in Python?
a) tuple(list)
b) tuple = list
c) tuple.from_list(list)
d) tuple.convert(list)
Question 18:
What is the purpose of the sorted() function when applied to a tuple?
a) Reverses the order of elements in the tuple
b) Sorts the elements of the tuple in ascending order
c) Removes duplicate elements from the tuple
d) Shuffles the elements of the tuple randomly
Question 19:
What does the tuple.index(element) method return if the element is not found in the tuple?
a) None
b) -1
c) 0
d) Raises a ValueError
Question 20:
What is the output of the following code?
my_tuple = (3, 1, 4, 1, 5, 9, 2)
my_tuple.sort()
print(my_tuple)
a) (1, 1, 2, 3, 4, 5, 9)
b) (9, 5, 4, 3, 2, 1, 1)
c) (1, 1, 2, 3, 4, 5, 9, 2)
d) (1, 2, 3, 4, 5, 9)
Python Coding January 19, 2024 Books, Python No comments
Best-selling author Al Sweigart shows you how to easily build over 80 fun programs with minimal code and maximum creativity.
If you’ve mastered basic Python syntax and you’re ready to start writing programs, you’ll find The Big Book of Small Python Projects both enlightening and fun. This collection of 81 Python projects will have you making digital art, games, animations, counting pro- grams, and more right away. Once you see how the code works, you’ll practice re-creating the programs and experiment by adding your own custom touches.
These simple, text-based programs are 256 lines of code or less. And whether it’s a vintage screensaver, a snail-racing game, a clickbait headline generator, or animated strands of DNA, each project is designed to be self-contained so you can easily share it online.
You’ll create:
• Hangman, Blackjack, and other games to play against your friends or the computer
• Simulations of a forest fire, a million dice rolls, and a Japanese abacus
• Animations like a virtual fish tank, a rotating cube, and a bouncing DVD logo screensaver
• A first-person 3D maze game
• Encryption programs that use ciphers like ROT13 and Vigenère to conceal text
If you’re tired of standard step-by-step tutorials, you’ll love the learn-by-doing approach of The Big Book of Small Python Projects. It’s proof that good things come in small programs!
Python Coding January 18, 2024 Python Coding Challenge No comments
Question 1:
What is a list in Python?
a) A collection of unordered elements
b) A collection of ordered elements
c) A single element
d) A data type
Question 2:
How do you create an empty list in Python?
a) list()
b) empty_list = []
c) empty_list = list()
d) Both b and c
Question 3:
How do you access the first element of a list?
a) list[0]
b) list.first()
c) list.first
d) list.get(0)
Question 4:
Which of the following statements is used to add an element to the end of a list?
a) list.insert(0, element)
b) list.add(element)
c) list.append(element)
d) list.extend(element)
Question 5:
What is the purpose of the len() function when used with a list?
a) It returns the total number of elements in the list
b) It returns the last element of the list
c) It returns the length of each element in the list
d) It returns the sum of all elements in the list
Question 6:
How do you check if an element is present in a list?
a) element in list
b) list.contains(element)
c) list.exists(element)
d) element.exists(list)
Question 7:
What does the list.remove(element) function do?
a) Removes the first occurrence of the specified element from the list
b) Removes all occurrences of the specified element from the list
c) Removes the last element from the list
d) Removes the element at the specified index
Question 8:
How do you reverse the order of elements in a list?
a) list.reverse()
b) list.sort(reverse=True)
c) list.reorder()
d) list.flip()
Question 9:
What is the difference between the append() and extend() methods in Python lists?
a) There is no difference, and the terms are interchangeable
b) append() adds a single element, while extend() adds multiple elements
c) extend() adds a single element, while append() adds multiple elements
d) Both methods are used for removing elements from a list
Question 10:
What is the output of the following code?
my_list = [1, 2, 3]
new_list = my_list * 2
print(new_list)
a) [1, 2, 3, 1, 2, 3]
b) [2, 4, 6]
c) [1, 4, 9]
d) [1, 2, 3, 6, 9]
Question 11:
Which method is used to find the index of the first occurrence of a specified element in a list?
a) list.index(element)
b) list.find(element)
c) list.search(element)
d) list.loc(element)
Question 12:
How do you copy the elements of one list to another list in Python?
a) new_list = old_list.copy()
b) new_list = old_list.clone()
c) new_list = copy(old_list)
d) new_list = old_list[:]
Question 13:
What is the purpose of the pop() method in Python lists?
a) Adds an element to the end of the list
b) Removes the last element from the list and returns it
c) Removes the first occurrence of the specified element
d) Sorts the elements of the list
Question 14:
What is the difference between a list and a tuple in Python?
a) Lists are mutable, while tuples are immutable
b) Lists are immutable, while tuples are mutable
c) Both lists and tuples are mutable
d) Both lists and tuples are immutable
Question 15:
How do you insert an element at a specific index in a list?
a) list.add(index, element)
b) list.insert(index, element)
c) list.insert(element, index)
d) list.put(index, element)
Question 16:
Which method is used to clear all elements from a list?
a) list.clear()
b) list.remove_all()
c) list.delete()
d) list.empty()
Question 17:
What does the sorted() function do when applied to a list?
a) Reverses the order of elements in the list
b) Sorts the elements of the list in ascending order
c) Removes duplicate elements from the list
d) Shuffles the elements of the list randomly
Question 18:
What is the purpose of the count() method in Python lists?
a) Counts the total number of elements in the list
b) Counts the occurrences of a specific element in the list
c) Counts the sum of all elements in the list
d) Counts the average value of elements in the list
Question 19:
How do you create a list of numbers from 1 to 5 in Python?
a) list = [1, 2, 3, 4, 5]
b) list = range(1, 6)
c) list = list(1, 6)
d) list = [range(1, 6)]
Question 20:
What is the output of the following code?
my_list = [3, 1, 4, 1, 5, 9, 2]
my_list.sort()
print(my_list)
a) [1, 1, 2, 3, 4, 5, 9]
b) [9, 5, 4, 3, 2, 1, 1]
c) [1, 1, 2, 3, 4, 5, 9, 2]
d) [1, 2, 3, 4, 5, 9]
Question 1: b) A collection of ordered elements
Question 2: d) Both b and c
Question 3: a) list[0]
Question 4: c) list.append(element)
Question 5: a) It returns the total number of elements in the list
Question 6: a) element in list
Question 7: a) Removes the first occurrence of the specified element from the list
Question 8: a) list.reverse()
Question 9: b) append() adds a single element, while extend() adds multiple elements
Question 10: a) [1, 2, 3, 1, 2, 3]
Question 11: a) list.index(element)
Question 12: d) new_list = old_list[:]
Question 13: b) Removes the last element from the list and returns it
Question 14: a) Lists are mutable, while tuples are immutable
Question 15: b) list.insert(index, element)
Question 16: a) list.clear()
Question 17: b) Sorts the elements of the list in ascending order
Question 18: b) Counts the occurrences of a specific element in the list
Question 19: b) list = range(1, 6)
Question 20: a) [1, 1, 2, 3, 4, 5, 9]
Python Coding January 18, 2024 Python Coding Challenge No comments
my_list = [1, 2]
new_list = my_list * 2
print(new_list)
The above code creates a new list new_list by repeating the elements of my_list twice using the * operator. Here's the output of the code:
my_list = [1, 2]
new_list = my_list * 2
print(new_list)
Output:
[1, 2, 1, 2]
As you can see, the elements [1, 2] from my_list are repeated, resulting in a new list [1, 2, 1, 2]. The * operator in this context duplicates the elements of the list the specified number of times.
Python Coding January 17, 2024 Python Coding Challenge No comments
Question 1:
What is Pandas?
a) A species of bear
b) A data manipulation and analysis library in Python
c) A programming language
d) A web development framework
Question 2:
Which of the following data structures is used to store one-dimensional labeled data in Pandas?
a) Series
b) DataFrame
c) Array
d) List
Question 3:
How can you import the Pandas library in Python?
a) import panda
b) import pandas as pd
c) from pandas import *
d) import pd
Question 4:
What is the primary purpose of a Pandas DataFrame?
a) Storing only numerical data
b) Storing two-dimensional labeled data
c) Storing images and multimedia files
d) Storing text data
Question 5:
Which Pandas function is used to read a CSV file into a DataFrame?
a) read_csv()
b) load_csv()
c) import_csv()
d) read_file()
Question 6:
How can you access a specific column in a Pandas DataFrame?
a) By using the column's index
b) By using the column's label or name
c) By using the row number
d) By using the DataFrame's index
Question 7:
What does the head() function do in Pandas?
a) Prints the first few rows of a DataFrame
b) Prints the last few rows of a DataFrame
c) Prints a summary statistics of the DataFrame
d) Prints the shape of the DataFrame
Question 8:
Which Pandas method is used to check for missing values in a DataFrame?
a) find_missing()
b) check_missing()
c) missing_values()
d) isnull()
Question 9:
What is the purpose of the iloc method in Pandas?
a) Selects columns based on their labels
b) Selects rows and columns based on their integer positions
c) Performs element-wise operations on a DataFrame
d) Checks for duplicate values in a DataFrame
Question 10:
How can you drop a column named "Column_A" from a Pandas DataFrame called df?
a) df.remove("Column_A")
b) df.drop("Column_A", axis=1)
c) df.delete("Column_A")
d) df.remove_column("Column_A")
Question 11:
Which Pandas function is used to filter rows based on a condition?
a) filter_rows()
b) select_rows()
c) filter()
d) query()
Question 12:
In Pandas, what is the purpose of the groupby() function?
a) Groups data based on unique values in a column
b) Reverses the order of rows in a DataFrame
c) Computes the mean of each column
d) Reshapes a DataFrame into a pivot table
Question 13:
How can you rename a specific column in a Pandas DataFrame?
a) rename_column()
b) change_column_name()
c) df.rename()
d) df.change_name()
Question 14:
What does the merge() function in Pandas do?
a) Merges two DataFrames based on a specified column or index
b) Adds a new column to a DataFrame
c) Sorts the rows of a DataFrame
d) Reshapes a DataFrame into a long format
Question 15:
Which Pandas function is used to pivot a DataFrame?
a) pivot()
b) reshape()
c) pivot_table()
d) transpose()
Question 16:
What is the purpose of the to_csv() function in Pandas?
a) Converts a DataFrame to a CSV file
b) Converts a CSV file to a DataFrame
c) Checks if a CSV file is valid
d) Counts the number of occurrences of each value in a DataFrame
Question 17:
Which method is used to fill missing values in a Pandas DataFrame with a specific value?
a) fillna()
b) fill_missing()
c) replace()
d) impute()
Question 18:
How can you sort a Pandas DataFrame based on a specific column?
a) df.sort_by("column_name")
b) df.sort("column_name")
c) df.sort_values("column_name")
d) df.order_by("column_name")
Question 19:
What is the purpose of the pivot_table() function in Pandas?
a) Pivots a DataFrame from long to wide format
b) Computes the sum of each column in a DataFrame
c) Transposes a DataFrame
d) Aggregates data based on one or more columns
Question 20:
Which Pandas function is used to calculate summary statistics of a DataFrame?
a) describe()
b) summary()
c) stats()
d) analyze()
Free Books Python Programming for Beginnershttps://t.co/uzyTwE2B9O
— Python Coding (@clcoding) September 11, 2023
Top 10 Python Data Science book
— Python Coding (@clcoding) July 9, 2023
🧵:
Top 4 free Mathematics course for Data Science ! pic.twitter.com/s5qYPLm2lY
— Python Coding (@clcoding) April 26, 2024
Web Development using Python
— Python Coding (@clcoding) December 2, 2023
🧵: