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

Saturday, 16 November 2024

Python Coding challenge - Day 246 | What is the output of the following Python Code?

 

x = "hello" * 2

print(x)

String Multiplication:


"hello" is a string.

2 is an integer.

When you multiply a string by an integer, the string is repeated that many times.

In this case, "hello" * 2 produces "hellohello", which is the string "hello" repeated twice.

Assignment:


The result "hellohello" is assigned to the variable x.

Print Statement:


The print(x) statement outputs the value of x, which is "hellohello".

Sunday, 3 November 2024

Python OOPS Challenge | Day 7 |What is the output of following Python code?


Let's go through this code snippet step-by-step:

try:
    print("1")
    raise Exception("2")
    print("3")
except Exception as e:
    print(str(e))
    print("4")

Explanation:

1. try Block Execution:

print("1"): This line executes first and outputs 1.

raise Exception("2"): This line raises an exception with the message "2". Because an exception is raised, the code execution immediately jumps to the except block, and the line print("3") is never executed.



2. except Block Execution:

print(str(e)): This line executes next, printing the exception message "2".

print("4"): This line then executes, printing 4.




Final Output:

The output is:

1
2
4

Correct Answer:

The correct answer is 124.


Friday, 1 November 2024

Python OOPS Challenge! Day 4 | What is the output of following Python code?


In this code snippet, an attempt is made to create an instance of the class SpaceObject, which inherits from ABC (Abstract Base Class) from Python's abc module. Here’s the breakdown of the code:

Explanation

1. Abstract Base Class (ABC):

The class SpaceObject inherits from ABC, which is used to define abstract base classes.

However, SpaceObject does not contain any abstract methods (methods decorated with @abstractmethod), making it a concrete class, even though it inherits from ABC.



2. Object Creation:

Since there are no abstract methods in SpaceObject, it is possible to instantiate this class directly.

The code obj = SpaceObject() will execute without any issues.



3. Output:

After creating the object, print('Object Creation') is called, which will print Object Creation to the console.




Conclusion

The correct answer is:

Object Creation



Python OOPS Challenge! Day 5 | What is the output of following Python code?


The code snippet contains a class Tablet with a static method printModel. However, there’s an issue with how this static method is defined and used.

Explanation

1. Static Method Misuse:

printModel is decorated with @staticmethod, which means it should not accept any arguments except for optional ones. However, self is being used as a parameter, which is misleading.

Static methods do not have access to instance-specific data, so they cannot use self to access instance attributes like self.model.



2. Error Triggered:

When Tablet.printModel() is called, it tries to execute print(self.model).

Because printModel is a static method, self is not automatically passed, leading to a missing argument error.

This will raise a TypeError, saying something like "printModel() takes 0 positional arguments but 1 was given."




Output

The correct answer is:

Exception


Tuesday, 8 October 2024

Clean Python Code: Best Practices for Writing Maintainable and Readable Python (Micro Learning | Python)

 




Clean Python Code: Best Practices for Writing Maintainable and Readable Python

Unlock the secrets of writing pristine Python code with "Clean Python Code: Best Practices for Writing Maintainable and Readable Python." This comprehensive guide is your roadmap to mastering the art of crafting elegant, efficient, and easily maintainable Python programs.

Key Features:
• Learn Pythonic thinking and embrace Python's unique philosophy
• Master naming conventions that enhance code readability
• Design robust functions and organize classes for optimal performance
• Structure modules effectively for scalability
• Implement proper error handling techniques
• Develop comprehensive testing strategies
• Create clear, concise documentation
• Optimize code performance without sacrificing readability
• Conduct effective code reviews and collaborate efficiently

Whether you're a beginner looking to establish good habits or an experienced developer aiming to refine your skills, this book caters to all levels of Python programmers. Packed with practical examples, real-world scenarios, and hands-on exercises, you'll gain the knowledge and confidence to write clean, Pythonic code that stands the test of time.

Author László Bocsó, a Microsoft Certified Trainer, distills years of industry experience into actionable insights, helping you avoid common pitfalls and elevate your coding practices. Learn how to reduce bugs, improve team collaboration, and create flexible, maintainable codebases that are a joy to work with.

Don't just write code that works – write code that shines. Get your copy of "Clean Python Code" today and transform the way you approach Python programming!

Keywords: Python programming, clean code, best practices, maintainable code, readable Python, Pythonic, code optimization, software development, coding standards, Python developer guide

Hard Copy : Clean Python Code: Best Practices for Writing Maintainable and Readable Python (Micro Learning | Python)

Python, Javascript, Java, SQL, Linux: The Complete Coding and Developing Crash Course for Beginners (2024)

 


The Complete Coding and Developing Crash Course for Beginners - From Zero to Hero 2024

Are you a beginner struggling to get started with coding in 2024? Overwhelmed by learning new programming languages? Looking for an easy-to-understand guide to take you from novice to confident coder?


If yes, then keep reading.

In Python, JavaScript, Java, SQL, Linux, you won't just learn these skills; you'll master them. This comprehensive 5-in-1 guide is tailored for complete beginners, offering a bootcamp-style approach that simplifies learning with practical examples, hands-on exercises, and real-world applications.

Whether you're just starting out or looking to refine your skills, this course will boost your confidence as you tackle coding challenges and set you apart in the job market. This book breaks down complex concepts into easy-to-understand modules, making it the perfect resource for anyone aiming to become a proficient coder.

Here's a Sneak Peek of What You'll Master in this 5-in-1 guide:


Book 1 - Python Programming

  • Basics: Learn variables, functions, loops, conditionals, and data types.
  • Data Structures: Master sequences, tuples, lists, matrices, and dictionaries.
  • Functions: Create and utilize functions effectively.
  • OOP: Understand classes, methods, and OOP principles.
  • Error Handling: Implement robust exception handling.
  • File Operations: Handle file reading, writing, and manipulation.
  • and so much more


Book 2 - JavaScript Programming

  • Fundamentals: Understand values, types, and operators.
  • Client-Side JavaScript: Learn advantages and limitations.
  • Development Tools: Explore JavaScript tools and environments.
  • Dynamic Web Pages: Create dynamic web pages.
  • Advanced JavaScript: Dive into higher-level concepts.
  • and so much more


Book 3 - Java Programming

  • Basics: Learn about variables, data types, and syntax.
  • OOP: Understand classes, objects, inheritance, and polymorphism.
  • Java Standard Library: Utilize essential classes and methods.
  • Exception Handling: Implement try-catch blocks.
  • Development Tools: Explore tools and environments.
  • and so much more

Book 4 - SQL

  • Foundations: Learn SQL basics, including data types, statements, and clauses.
  • Database Management: Create, modify, and manage databases and tables.
  • Complex Queries: Execute joins, unions, and advanced queries.
  • Performance Optimization: Optimize SQL queries.
  • Data Integrity: Implement primary keys, foreign keys, and constraints.
  • and so much more

Book 5 - Linux

  • Basics: Understand Linux concepts and distributions.
  • Command Line: Master Linux commands and shell scripting.
  • System Administration: Manage users, groups, and file permissions.
  • Networking: Configure and troubleshoot network settings.
  • Security: Implement security measures and manage firewalls.
  • and so much more

This isn't just a book. It's a career booster. ✅ Whether you're aiming for a new job or developing your own software, this guide has everything you need. Find practical advice and skills to propel your career, set you apart from peers, and make you an invaluable asset to any organization.


Hard Copy: Python, Javascript, Java, SQL, Linux: The Complete Coding and Developing Crash Course for Beginners (2024)

Monday, 9 September 2024

Python Coding challenge - Day 244 | What is the output of the following Python Code?

 

In this code snippet:

s = 'clcoding'

index = s.find('z')

print(index)

s = 'clcoding': This assigns the string 'clcoding' to the variable s.

s.find('z'): The .find() method is used to search for the first occurrence of the specified substring 'z' in the string s. If the substring is found, it returns the index (position) of its first occurrence. If the substring is not found, .find() returns -1.

Since 'z' is not in the string 'clcoding', s.find('z') will return -1.

print(index): This prints the value of index, which in this case is -1.

Output:  -1

Sunday, 8 September 2024

Python Coding challenge - Day 243 | What is the output of the following Python Code?

 


Code:

s = 'clcoding.com'
index = s.find('com')
print(index)

Solution and Explanation: 

Explanation:

s = 'clcoding.com':

This defines a string variable s with the value 'clcoding.com'.

index = s.find('com'):

The find() method searches for the substring 'com' in the string s.

It returns the index of the first character of the first occurrence of the substring.

If the substring is not found, find() returns -1.

In this case, 'com' is present in 'clcoding.com', and it starts at index 9.

print(index):

This prints the value of index, which is 9.

String Breakdown:

The string 'clcoding.com' has characters at the following positions:

Index:  0 1 2 3 4 5 6 7 8 9 10 11

Chars:  c l c o d i n g . c  o  m

Here, the substring 'com' starts at index 9.

Output: 9

The find() method is useful for locating substrings within a string. In this case, it returns the index where 'com' begins.

Saturday, 31 August 2024

Python Coding challenge - Day 242 | What is the output of the following Python Code?

 


Code:

a = [1, 2, 3]

b = a[:]

a.append(4)

print(b)

Solution and Explanation: 

Step 1: a = [1, 2, 3]

This creates a list a containing the elements [1, 2, 3].

Step 2: b = a[:]

The [:] syntax creates a shallow copy of the list a.

This means that b will be a new list with the same elements as a but stored in a different memory location.

After this line, b contains [1, 2, 3].

Step 3: a.append(4)

The append() method adds the element 4 to the end of the list a.

Now, a contains [1, 2, 3, 4].

However, since b is a separate list (created by the shallow copy), it remains unchanged.

Step 4: print(b)

When you print b, it outputs [1, 2, 3], because b was not modified when a was appended with 4.

Summary:

The key point is that b is a separate copy of the list a at the time of copying. Any subsequent modifications to a do not affect b.

The final output of the code is [1, 2, 3].

Saturday, 24 August 2024

Python Coding challenge - Day 241 | What is the output of the following Python Code?


Code:

a = [1, 2, 3]

b = a

a.append(4)

print(b)

Solution and Explanantion: 

 a = [1, 2, 3]:

This line creates a list a with elements [1, 2, 3].

b = a:

Here, b is not a new list but a reference to the same list object that a refers to. In Python, variables that hold lists (and other mutable objects) actually hold references to the memory location where the list is stored. So, b now refers to the same list as a.

a.append(4):

This line adds the element 4 to the end of the list a. Since a and b refer to the same list, this modification affects both a and b.

print(b):

Since b refers to the same list as a, the output will show the modified list [1, 2, 3, 4].

Final Output:

[1, 2, 3, 4]

The key concept here is that a and b are references to the same list in memory, so changes to the list via one variable are reflected in the other.

Saturday, 17 August 2024

Python Coding challenge - Day 240 | What is the output of the following Python Code?

 

def func(x=[]):

    x.append(1)

    return x

print(func())

print(func())

Solution and Explanation: B is the correct answer

Default Argument Behavior:

The default argument x=[] is evaluated only once when the function is defined, not each time the function is called. This means that if the default value is a mutable object like a list, it will be shared across all calls to the function.

First Function Call (print(func())):

The first time func() is called, the list x is empty because the default value ([]) is used.
Inside the function, 1 is appended to the list, so x becomes [1].
The function returns this list, which is then printed, so the output is:

Second Function Call (print(func())):

The second time func() is called, the same list x from the previous call is used, not a new empty list.
Again, 1 is appended to this list, so x becomes [1, 1].
The function returns this list, which is then printed, so the output is:
[1, 1]

Mutable Default Arguments: In Python, using a mutable object (like a list or dictionary) as a default argument can lead to unexpected behavior because it persists across function calls.
Best Practice: To avoid this, use None as the default value and then initialize the mutable object inside the function if needed.

Saturday, 3 August 2024

Python Coding challenge - Day 239 | What is the output of the following Python Code?

 

cl1 = "hello"

cl1_unicode = "hell\u00f6"

print(cl1 != cl1_unicode)

In Python, the comparison cl1 != cl1_unicode checks whether the two strings cl1 and cl1_unicode are different.


Here's the breakdown:

cl1 = "hello": This string contains the characters "h", "e", "l", "l", "o".

cl1_unicode = "hell\u00f6": This string contains the characters "h", "e", "l", "l", followed by the Unicode character \u00f6, which represents "ö".

When comparing cl1 and cl1_unicode:

"hello" is different from "hellö" because the last character in cl1_unicode ("ö") is different from the last character in cl1 ("o").

So, cl1 != cl1_unicode evaluates to True because the strings are not identical.

The print statement outputs True, indicating the strings are not equal.


Thursday, 25 July 2024

Python Coding challenge - Day 238 | What is the output of the following Python Code?

 

In Python, dictionaries are compared based on their keys and corresponding values. When you use the != operator to compare two dictionaries, it checks if there is any difference between them.

Here’s the explanation for the given code:

dict1 = {"a": 1, "b": 2}

dict2 = {"a": 1, "b": 3}

print(dict1 != dict2)

Dictionary Creation:

dict1 is created with keys "a" and "b" having values 1 and 2, respectively.

dict2 is created with keys "a" and "b" having values 1 and 3, respectively.

Comparison:

The comparison dict1 != dict2 checks if dict1 is not equal to dict2.

Python compares each key-value pair in dict1 with the corresponding key-value pair in dict2.

Key-Value Comparison:

Both dictionaries have the same keys: "a" and "b".

For key "a", both dictionaries have the value 1. So, these are equal.

For key "b", dict1 has the value 2 and dict2 has the value 3. These are not equal.

Since there is at least one key-value pair that differs ("b": 2 in dict1 vs. "b": 3 in dict2), the dictionaries are considered not equal.

Result:

The expression dict1 != dict2 evaluates to True.

Therefore, the output of print(dict1 != dict2) will be True, indicating that dict1 is not equal to dict2.

Sunday, 21 July 2024

Python Coding challenge - Day 237 | What is the output of the following Python Code?

 

This Python code defines a function and then calls it with specific arguments. Let's break it down step by step:

Function Definition:

def func(x, y):

    return x + y

def func(x, y):: This line defines a function named func that takes two parameters, x and y.

return x + y: This line specifies that the function will return the sum of x and y.

Function Call:

print(func(y=2, x=3))

func(y=2, x=3): This calls the func function with x set to 3 and y set to 2. The order of the arguments doesn't matter here because they are passed as keyword arguments.

The function func adds x and y, so 3 + 2 results in 5.

print(5): The print function then outputs the result, which is 5.

Putting it all together, the code defines a function that adds two numbers, then calls the function with x as 3 and y as 2, and prints the result, which is 5.

Saturday, 20 July 2024

Python Coding challenge - Day 236 | What is the output of the following Python Code?

 

The code provided consists of two parts: defining a dictionary and using the fromkeys method to create a new dictionary. Let's break it down:

Defining a Dictionary:

d = {'a': 1, 'b': 2, 'c': 3}

Here, d is a dictionary with three key-value pairs:

'a' maps to 1

'b' maps to 2

'c' maps to 3

Using dict.fromkeys:

print(dict.fromkeys(d, 0))

The dict.fromkeys method is used to create a new dictionary from the keys of an existing iterable (in this case, the dictionary d). The method signature is:

dict.fromkeys(iterable, value)

iterable: An iterable containing keys.

value: The value to assign to each key in the new dictionary.

In this code, d is used as the iterable. When d is used as an iterable, it provides its keys ('a', 'b', and 'c'). The second argument is 0, which means all keys in the new dictionary will have the value 0.


Therefore, the new dictionary created by dict.fromkeys(d, 0) will have the same keys as d but with all values set to 0:

{'a': 0, 'b': 0, 'c': 0}

Output:

The print statement will output:

{'a': 0, 'b': 0, 'c': 0}

In summary, the code defines a dictionary d and then creates a new dictionary with the same keys as d but with all values set to 0, and prints this new dictionary.

Friday, 19 July 2024

Why you should use PEP 8 guidelines ?

 

7. Error Prevention

Reason: PEP 8 includes guidelines that help prevent common errors, such as mixing tabs and spaces for indentation.


Without PEP 8:


def calculate_sum(a, b):

  return a + b

    print("Sum calculated")

  Cell In[16], line 3

    print("Sum calculated")

    ^

IndentationError: unexpected indent

With PEP 8:


def calculate_sum(a, b):

    return a + b


print("Sum calculated")

Sum calculated

6. Community Standard

Reason: PEP 8 is the de facto standard for Python code. Following it ensures your code aligns with what other Python developers expect, making it easier for others to read and contribute to your projects.


Without PEP 8:


class Person: 

  def __init__(self,name,age):

    self.name=name

    self.age=age

  def getDetails(self):

    return self.name + " is " + str(self.age)

With PEP 8:


class Person:

    def __init__(self, name, age):

        self.name = name

        self.age = age


    def get_details(self):

        return f"{self.name} is {self.age}"

5. Professionalism

Reason: Following PEP 8 shows that you care about writing high-quality code. It demonstrates professionalism and attention to detail, which are valuable traits in any developer.


Without PEP 8:


def square(x):return x*x

With PEP 8:


def square(x):

    return x * x

4. Maintainability

Reason: Code that adheres to a standard style is easier to maintain and update. PEP 8’s guidelines help you write code that is more maintainable in the long run.


Without PEP 8:


def processData(data): 

  result = data["name"].upper() + " is " + str(data["age"]) + " years old"

  return result


    

With PEP 8:


def process_data(data):

    result = f"{data['name'].upper()} is {data['age']} years old"

    return result


#clcoding.com

3. Collaboration

Reason: When everyone on a team follows the same style guide, it’s easier for team members to read and understand each other’s code, making collaboration smoother.


Without PEP 8:


def fetchData(): 

  # fetch data from API

  data = {"name":"John","age":30}

  return data

With PEP 8:


def fetch_data():

    # Fetch data from API

    data = {"name": "John", "age": 30}

    return data

2. Readability

Reason: Readable code is easier to understand and debug. PEP 8 encourages practices that make your code more readable.


Without PEP 8:


def add(a,b):return a+b

With PEP 8:


def add(a, b):

    return a + b

1. Consistency

Reason: Consistent code is easier to read and understand. PEP 8 provides a standard style guide that promotes consistency across different projects and among different developers.


Without PEP 8:


def my_function():print("Hello"); print("World")

my_function()

Hello

World

With PEP 8:


def my_function():

    print("Hello")

    print("World")


my_function()

Hello

World

Python Coding challenge - Day 235 | What is the output of the following Python Code?

 

In Python, memoryview is a built-in class that allows you to access the memory of an object without copying it. This can be useful for performance reasons, especially when dealing with large data sets or when you want to manipulate data in place.

Here's a breakdown of the code snippet you provided:

x = memoryview(b'clcoding')

print(type(x))

Creating a memoryview object:

b'clcoding' is a bytes object. The b prefix indicates that this is a bytes literal, which is a sequence of bytes.

memoryview(b'clcoding') creates a memoryview object that exposes the memory of the bytes object b'clcoding' without copying it.

Printing the type of the memoryview object:

print(type(x)) prints the type of the object x.

When you run this code, you will get the following output:

<class 'memoryview'>

This output indicates that x is an instance of the memoryview class.

Why use memoryview?

Efficiency: It allows you to access and manipulate data without copying it, which can save memory and improve performance.

Slicing and indexing: You can use memoryview to slice and index data structures such as bytes, bytearray, and other objects that support the buffer protocol.

Interoperability: It can be useful when working with binary data and interfacing with C/C++ extensions or other low-level APIs.

Example Usage

Here's a simple example to demonstrate the usage of memoryview:

data = b'clcoding'

mv = memoryview(data)

# Accessing elements

print(mv[0])  # Output: 99 (ASCII value of 'c')

# Slicing

print(mv[1:4])  # Output: <memory at 0x...> (a slice of the memoryview)

# Converting back to bytes

print(mv.tobytes())  # Output: b'clcoding'

In this example:

mv[0] accesses the first byte, which is 99, the ASCII value of 'c'.

mv[1:4] creates a new memoryview object that is a slice of the original memoryview.

mv.tobytes() converts the memoryview back to a bytes object.

Using memoryview is particularly beneficial when you need to work with large data structures efficiently.

Monday, 15 July 2024

Practical Uses of continue and break Statements

 

Example 5: Summing Non-Negative Numbers

Using continue to skip negative numbers and sum the non-negative ones.


numbers = [10, -5, 20, -10, 30]

total = 0


for num in numbers:

    if num < 0:

        continue  # Skip negative numbers

    total += num


print(f"Total sum of non-negative numbers is: {total}")


#clcoding.com

Total sum of non-negative numbers is: 60

Example 4: Finding the First Negative Number

Using break to find and print the first negative number in a list.


numbers = [10, 20, -5, 30, -10]


for num in numbers:

    if num < 0:

        print(f"First negative number is: {num}")

        break  


#clcoding.com

First negative number is: -5

Example 3: Skipping a Specific Number and Stopping at Another

Combining continue and break to skip the number 3 and stop at 7.


for i in range(1, 11):

    if i == 3:

        continue  # Skip the number 3

    if i == 7:

        break  # Stop the loop when i is 7

    print(i)


#clcoding.com

1

2

4

5

6

Example 2: Stopping at a Specific Number

Using break to stop the loop when encountering the number 5.


for i in range(1, 11):

    if i == 5:

        break 

    print(i)


#clcoding.com

1

2

3

4

Example 1: Skipping Even Numbers

Using continue to skip even numbers in a loop.


for i in range(1, 11):

    if i % 2 == 0:

        continue  

    print(i)


#clcoding.com

1

3

5

7

9

Sunday, 14 July 2024

Python Coding challenge - Day 234 | What is the output of the following Python Code?

 

Class Definition

Class Vehicle:

class Vehicle:

    def __init__(self, color):

        self.color = color

Class Declaration: class Vehicle: defines a class named Vehicle.

Constructor: def __init__(self, color): defines the constructor method (__init__). It initializes a new instance of Vehicle.

Instance Variable: self.color = color assigns the value of the parameter color to the instance variable self.color.

Class Car (Inheritance):

class Car(Vehicle):

    def __init__(self, color, model):

        super().__init__(color)

        self.model = model

Class Declaration with Inheritance: class Car(Vehicle): defines a class named Car that inherits from the Vehicle class.

Constructor: def __init__(self, color, model): defines the constructor method (__init__). It initializes a new instance of Car.

Calling Superclass Constructor: super().__init__(color) calls the constructor of the superclass Vehicle to initialize the color attribute.

Instance Variable: self.model = model assigns the value of the parameter model to the instance variable self.model.

Object Instantiation

Creating an Instance:

my_car = Car("Red", "Toyota")

This line creates an instance of the Car class with color set to "Red" and model set to "Toyota". The constructor of the Vehicle class is also called to initialize the color attribute.

Accessing Attributes

Printing the Model:

print(my_car.model)

This line prints the model attribute of the my_car object, which is "Toyota".

Complete Code

Here is the complete code for clarity:

class Vehicle:

    def __init__(self, color):

        self.color = color

class Car(Vehicle):

    def __init__(self, color, model):

        super().__init__(color)

        self.model = model

my_car = Car("Red", "Toyota")

print(my_car.model)

Output

The output of the code is: Toyota

Explanation Summary

Vehicle Class: Defines a vehicle with a color.

Car Class: Inherits from Vehicle and adds a model attribute.

Object Creation: An instance of Car is created with color "Red" and model "Toyota".

Attribute Access: The model attribute of my_car is printed, displaying "Toyota".

Saturday, 13 July 2024

Python Coding challenge - Day 233 | What is the output of the following Python Code?



 Let's break down the code and explain what each part does:

my_list = [1, 2, 3, 4, 5]

my_list[1:3] = []

print(my_list)

Step-by-Step Explanation

Create a List:

my_list = [1, 2, 3, 4, 5]

This line initializes a list named my_list with the elements [1, 2, 3, 4, 5].

Slice Assignment:

my_list[1:3] = []

my_list[1:3] is a slice of the list from index 1 to index 3, but not including index 3. In this case, my_list[1:3] refers to the sublist [2, 3].

The assignment my_list[1:3] = [] replaces the slice [2, 3] with an empty list [], effectively removing the elements 2 and 3 from the list.

Print the Modified List:

print(my_list)

This line prints the modified list.

After the slice assignment, my_list is modified to remove the elements at indices 1 and 2 (the elements 2 and 3). The resulting list is:

[1, 4, 5]

Visual Breakdown

Let's visualize the process:

Initial list: [1, 2, 3, 4, 5]

Slice my_list[1:3] refers to [2, 3]

Assigning [] to the slice removes [2, 3]

Resulting list: [1, 4, 5]

Full Code with Output

Here is the complete code along with its output:

my_list = [1, 2, 3, 4, 5]

my_list[1:3] = []

print(my_list)  # Output: [1, 4, 5]

The output is [1, 4, 5], as explained.

Popular Posts

Categories

AI (32) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (198) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (13) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (21) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (888) Python Coding Challenge (285) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses