Data Pragmatist

148 posts

Data Pragmatist

Data Pragmatist

@datapragmatist

Newsletter connecting Theory and Real life

Katılım Ağustos 2023
127 Takip Edilen330 Takipçiler
Data Pragmatist
Data Pragmatist@datapragmatist·
@clcoding The code will result in an error. Tuples are immutable in Python, which means their elements cannot be changed after creation. Attempting to change an element in a tuple using `Tuple[1] = 8` will raise a "TypeError" because you cannot assign a new value to an element in a tuple.
English
0
0
2
518
Python Coding
Python Coding@clcoding·
What is the output of following Python Code?
Python Coding tweet media
English
194
88
831
224.9K
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv a. 3.3333333333333335 quotient of 10/3 div of integers but stops at sixteen decimal point which is the default floating point in python. It may not always ends in 5 depending on the decimal module.
English
0
0
0
166
Data Pragmatist
Data Pragmatist@datapragmatist·
We are back with yet another insightful episode of our ‘Analytical Voyages” In this episode, we are glad to introduce you to Jacob Marks (@QuantumMarks) a Machine Learning Engineer and Developer Evangelist at Voxel51. Read the exclusive interview here: datapragmatist.com/p/navigating-d…
English
2
0
3
578
Data Pragmatist retweetledi
Arun Chinnachamy
Arun Chinnachamy@ArunChinnachamy·
Little bit of personalisation can make lot of difference. Tried A/B on greeting with first name for few subscribers of @datapragmatist. Response has been great. Looking ways to update for 10K subscribers now. @beehiiv makes A/B easy. Time to try API integrations.
English
1
2
10
686
Data Pragmatist
Data Pragmatist@datapragmatist·
@clcoding It looks like you're trying to print the string 'py' instead of the result of the expression `2 + 3`. To print the result of the addition, you should remove the quotes around 'py' like this: ```python py = 2 + 3 print(py) ``` This will print the value of `py`, which is 5.
English
1
0
2
178
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv The code prints "22" because the `range` parameters (start=22, stop=23, step=24) create a sequence where the starting value (22) is greater than the stopping value (23), causing the loop to run only once with the initial value of 22.
English
0
1
10
911
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv The code defines a set called `colors` with initial elements "Black," "Blue," and "Green." It then adds "Red" and "Blue" to the set. Finally, it prints the content of the set. Output: ``` {'Green', 'Black', 'Blue', 'Red'} ```
English
0
0
5
501
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo The code you provided calculates the number of keys in a dictionary and returns it. In this case, it will return 2, as there are two keys in the dictionary. Output: 2
English
0
0
3
412
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Happy Wednesday What is the output of this code and why?🤔🤔
Benjamin Bennett Alexander tweet media
English
54
33
278
71.5K
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo This code snippet directly replaces the last element of the `my_list` with `'modified'` and then prints the updated list, effectively changing `'values'` to `'modified'`.
English
0
0
4
303
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Let's play around with lists. What is the output of this code, and why?🤔🤔
Benjamin Bennett Alexander tweet media
English
35
18
140
27.4K
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo Output will be a randomly chosen word from the list ["encounter", "and", "disappointed"]. Here's an example of what the output might look like, but remember that it can vary each time you run the code: ``` encounter ``` If you run the code again, you might get a different word.
English
1
0
4
479
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Let's start this week strong. Happy Monday. What is the output of this code, and why?🤔🤔
Benjamin Bennett Alexander tweet media
English
67
32
227
75.8K
Data Pragmatist
Data Pragmatist@datapragmatist·
@clcoding The code you provided removes the elements from index 1 to 3 (inclusive) from the list `r`, effectively leaving only the element at index 0. So, the output of this code will be: ``` [20] ```
English
0
0
3
976
Python Coding
Python Coding@clcoding·
What is the output of the following Python code? r = [20, 40, 60, 80] r[1:4] = [] print(r)
English
40
26
252
170.1K
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo Output: TRUE Your code defines a `Dog` class, creates an instance `dog1` of that class with the name "Dino" and breed "Poodle," and then checks if `dog1` is an instance of the `Dog` class. The output is `True` because `dog1` is indeed an instance of the `Dog` class.
English
0
0
3
263
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Happy Saturday What is the output of this code, and why?
Benjamin Bennett Alexander tweet media
English
39
18
252
76.9K
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo Output: 20. This is because the function multiply_func takes value, multiplies it by 1 (which has no effect), and then doubles it before returning the result. So, 10 * 2 equals 20.
English
0
0
3
196
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Happy Thursday What is the output of this code, and why?🤔🤔
Benjamin Bennett Alexander tweet media
English
53
28
225
65.7K
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv In Python, a = a + b creates a new object, while a += b modifies the original object in place.
English
0
1
4
184
Data Pragmatist
Data Pragmatist@datapragmatist·
@clcoding Output: [2, 5, 2, 3, 4] In this code, you're modifying the list 'a' by slicing it from index 2 to index 2 (an empty slice), and then inserting the value 2 at that position. This effectively inserts 2 into the list at index 2, pushing the existing elements to the right.
English
0
0
1
245
Data Pragmatist
Data Pragmatist@datapragmatist·
@RealBenjizo The code compares two values: `x` and `y`. `x` is `True` because `[None]` is considered a non-empty list. `y` is also `True` because `[None or 1]` results in `1`. Therefore, `x == y` is `True`, so the output is: ``` True ```
English
0
0
2
223
Benjamin Bennett Alexander
Benjamin Bennett Alexander@RealBenjizo·
Python Question; Happy midweek, everyone. What is the output of this code, and why?🤔🤔
Benjamin Bennett Alexander tweet media
English
23
28
159
38.5K
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv The code combines the first three letters of "Dhoni" with all letters from the second letter onward in "Kohli," resulting in "Dhohli."
English
1
0
4
848
Data Pragmatist
Data Pragmatist@datapragmatist·
@clcoding The code starts with `x` as `['1']`, and after `x.extend('234')`, `x` becomes `['1', '2', '3', '4']`.
English
0
0
2
379
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv Output: ``` Hello Error Finally ``` Explanation: - "Hello" is printed first. - "Error" is printed because of the raised exception. - "Finally" is printed because the `finally` block always executes.
English
1
0
3
766
Data Pragmatist
Data Pragmatist@datapragmatist·
@Python_Dv The code prints the first element of the list `[10, 201]`, which is `10`. The code defines a function func that takes a list elements as an argument and then iterates through the elements in the list. However, it immediately returns the first element it encounters.
English
0
0
1
147