tag:blogger.com,1999:blog-67173207629383721302024-03-18T20:06:06.786-07:00Computer Languages (clcoding)Unknownnoreply@blogger.comBlogger1659125tag:blogger.com,1999:blog-6717320762938372130.post-6271195827017163862024-03-18T20:01:00.000-07:002024-03-18T20:05:21.522-07:00Python pattern challenge - Day 2<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoWGvYLIj3RFrKsvWpvkaREC0syw8OCLw-9Oh6jneQgdUkUr8NN3f3O9QpVi1b31Z-UZE5xsrd6A5VhYijU92JPIgA_eygRYiTl_5UlW8mSRpVTjbGDOFZBnG5ajtjB0LmCrpl4VStgzO4skJfHTARhWPYRNRfI9fNcYHKVR__36zRWP978VdZWz33_M8/s451/Python%20pattern%20challenge%20-%20Day%202.jpeg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="421" data-original-width="451" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoWGvYLIj3RFrKsvWpvkaREC0syw8OCLw-9Oh6jneQgdUkUr8NN3f3O9QpVi1b31Z-UZE5xsrd6A5VhYijU92JPIgA_eygRYiTl_5UlW8mSRpVTjbGDOFZBnG5ajtjB0LmCrpl4VStgzO4skJfHTARhWPYRNRfI9fNcYHKVR__36zRWP978VdZWz33_M8/s16000/Python%20pattern%20challenge%20-%20Day%202.jpeg" /></a></div><h3 style="text-align: left;">Method 1: Using Nested Loops</h3><p></p><div>def print_pattern(rows):</div><div><div> for i in range(rows):</div><div> num = 1</div><div> for j in range(1, i + 2):</div><div> print(num, end='')</div><div> num = num * (i + 1 - j) // j</div><div> print()</div><div><br /></div><div>print_pattern(5) </div><div> # Change the argument to adjust the number of rows</div></div><div><br /></div><div><div>let's break down the code step by step:</div><div><br /></div><div>def print_pattern(rows):: This line defines a function named print_pattern that takes one argument rows, which represents the number of rows in the pattern.</div><div><br /></div><div>for i in range(rows):: This loop iterates over each row of the pattern. It goes from 0 to rows - 1.</div><div><br /></div><div>num = 1: Initializes the variable num to 1 for each row. This variable will hold the numbers to be printed on each row.</div><div><br /></div><div>for j in range(1, i + 2):: This loop iterates over each column in the current row. It goes from 1 to i + 1.</div><div><br /></div><div>print(num, end=''): Prints the value of num without a newline character. This ensures that all numbers in the same row are printed on the same line.</div><div><br /></div><div>num = num * (i + 1 - j) // j: This line updates the value of num for the next column. It calculates the next number in the row based on the previous number using the formula (i + 1 - j) / j. This formula generates Pascal's triangle pattern.</div><div><br /></div><div>print(): Prints a newline character after printing all numbers in the current row, moving to the next row.</div><div><br /></div><div>print_pattern(5): Calls the print_pattern function with an argument of 5, which means it will print a pattern with 5 rows. You can change this argument to adjust the number of rows in the pattern.</div><div><br /></div><div>The pattern generated by this code resembles Pascal's triangle, where each number in a row is the sum of the two numbers directly above it in the previous row.</div></div><div><br /></div><h3 style="text-align: left;">Method 2: Using Recursion</h3><div><div>def print_pattern_recursive(rows):</div><div> if rows == 0:</div><div> return</div><div> print_pattern_recursive(rows - 1)</div><div> row = [1]</div><div> for i in range(1, rows):</div><div> row.append(row[-1] * (rows - i) // i)</div><div> print("".join(map(str, row)))</div><div><br /></div><div>print_pattern_recursive(5) </div><div># Change the argument to adjust the number of rows</div></div><div><br /></div><div><div> let's break down the code step by step:</div><div><br /></div><div>def print_pattern_recursive(rows):: This line defines a function named print_pattern_recursive that takes one argument rows, which represents the number of rows in the pattern.</div><div><br /></div><div>if rows == 0:: This is the base case for the recursion. If rows is equal to 0, the function returns immediately, as there's no pattern to print.</div><div><br /></div><div>return: This statement exits the function immediately if the base case is met.</div><div><br /></div><div>print_pattern_recursive(rows - 1): This is the recursive call. It calls the print_pattern_recursive function with rows - 1, effectively reducing the number of rows to be printed in each recursive call.</div><div><br /></div><div>row = [1]: Initializes a list row with a single element, 1. This represents the first row of the pattern.</div><div><br /></div><div>for i in range(1, rows):: This loop iterates over each row index starting from 1 up to rows - 1.</div><div><br /></div><div>row.append(row[-1] * (rows - i) // i): This line calculates and appends the next number to the row list. It uses the formula to generate Pascal's triangle pattern: (previous_number * (rows - i)) / i. This formula generates each number in the current row based on the numbers in the previous row.</div><div><br /></div><div>print("".join(map(str, row))): This line prints the current row as a string by joining all elements in the row list and separating them with an empty string. This effectively prints the numbers of the current row without spaces between them.</div><div><br /></div><div>print_pattern_recursive(5): Calls the print_pattern_recursive function with an argument of 5, which means it will print a pattern with 5 rows. You can change this argument to adjust the number of rows in the pattern.</div><div><br /></div><div>The pattern generated by this code is similar to Pascal's triangle, where each number in a row is the sum of the two numbers directly above it in the previous row. However, this code generates each row recursively.</div></div><h3 style="text-align: left;">Method 3: Using List Comprehension</h3><div><br /></div><div><div>def print_pattern_list_comprehension(rows):</div><div> pattern = [[1]]</div><div> [pattern.append([1] + [pattern[-1][j] + pattern[-1][j + 1] for j in range(len(pattern[-1]) - 1)] + [1]) for _ in range(1, rows)]</div><div> [print("".join(map(str, p))) for p in pattern]</div><div><br /></div><div>print_pattern_list_comprehension(5) </div><div># Change the argument to adjust the number of rows</div></div><div><br /></div><div><div>Let's break down the code step by step:</div><div><br /></div><div>def print_pattern_list_comprehension(rows):: This line defines a function named print_pattern_list_comprehension that takes one argument rows, representing the number of rows in the pattern.</div><div><br /></div><div>pattern = [[1]]: Initializes a list pattern with a nested list containing a single element, which is [1]. This represents the first row of the pattern.</div><div><br /></div><div>[pattern.append([1] + [pattern[-1][j] + pattern[-1][j + 1] for j in range(len(pattern[-1]) - 1)] + [1]) for _ in range(1, rows)]: This is a list comprehension that generates the pattern rows. It iterates over a range starting from 1 up to rows - 1.</div><div><br /></div><div>pattern[-1] accesses the last row in the pattern list.</div><div><br /></div><div>[pattern[-1][j] + pattern[-1][j + 1] for j in range(len(pattern[-1]) - 1)] generates the elements of the new row based on the previous row. It iterates over indices j of the previous row and calculates each element by summing adjacent elements.</div><div><br /></div><div>[1] is appended at the beginning and end of the row to maintain the pattern structure.</div><div><br /></div><div>pattern.append(...) adds the newly generated row to the pattern list.</div><div><br /></div><div>[print("".join(map(str, p))) for p in pattern]: This is another list comprehension that prints each row of the pattern. It iterates over each row p in the pattern list, converts each element to a string, joins them without any separator using "".join(), and then prints the resulting string.</div><div><br /></div><div>print_pattern_list_comprehension(5): Calls the print_pattern_list_comprehension function with an argument of 5, which means it will print a pattern with 5 rows. You can change this argument to adjust the number of rows in the pattern.</div><div><br /></div><div>The pattern generated by this code is similar to Pascal's triangle, where each number in a row is the sum of the two numbers directly above it in the previous row. However, this code utilizes list comprehensions to generate and print the pattern efficiently.</div></div><div><br /></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-5329916070545631742024-03-18T08:11:00.000-07:002024-03-18T08:17:21.546-07:00The faker library in Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguO0WhmF1EL9Rtc9k24ozB0xMKmZ3jrFMt-pk9WD3KbV39z_VutLNmlSD4E3uXhx1EIGe-d-NkYi1-slyttoRrXHigi1Xi1Vsb1GiHlUIuqcaeK02KAVEA3BlQ7sUJpa2EIrch4XanBkScfR8Ppumqaz2GiXKUVUzNoexLBw1zq6K8MuKvqbd8zdV8R8I/s1080/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguO0WhmF1EL9Rtc9k24ozB0xMKmZ3jrFMt-pk9WD3KbV39z_VutLNmlSD4E3uXhx1EIGe-d-NkYi1-slyttoRrXHigi1Xi1Vsb1GiHlUIuqcaeK02KAVEA3BlQ7sUJpa2EIrch4XanBkScfR8Ppumqaz2GiXKUVUzNoexLBw1zq6K8MuKvqbd8zdV8R8I/s16000/1.png" /></a></div><br /><p></p><div><div>The faker library in Python</div><h3 style="text-align: left;"><br />Installing faker:</h3><div>pip install faker</div><div><br /></div><h3 style="text-align: left;">Generating Fake Names:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate a fake name</div><div>fake_name = faker.name()</div><div>print("Fake Name:", fake_name)</div><div><br /></div><div>#clcoding.com</div><div>Fake Name: Anthony Ortiz</div><h3 style="text-align: left;">Generating Fake Addresses:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate a fake address</div><div>fake_address = faker.address()</div><div>print("Fake Address:", fake_address)</div><div><br /></div><div>#clcoding.com </div><div>Fake Address: 098 Parker Burg Suite 277</div><div>Olsonborough, IN 35433</div><h3 style="text-align: left;">Generating Fake Email Addresses:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate a fake email address</div><div>fake_email = faker.email()</div><div>print("Fake Email Address:", fake_email)</div><div><br /></div><div>#clcoding.com </div><div>Fake Email Address: choward@example.com</div><h3 style="text-align: left;">Generating Fake Text:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate fake text</div><div>fake_text = faker.text()</div><div>print("Fake Text:\n", fake_text)</div><div><br /></div><div>#clcoding.com</div><div>Fake Text:</div><div> Election huge event. Remember go else purpose specific detail position eight. High project outside quickly try research.</div><div>Degree affect detail together. Way company along relate set.</div><h3 style="text-align: left;">Generating Fake Dates:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate a fake date</div><div>fake_date = faker.date_of_birth()</div><div>print("Fake Date of Birth:", fake_date)</div><div><br /></div><div>#clcoding.com</div><div>Fake Date of Birth: 1950-10-06</div><h3 style="text-align: left;">Generating Fake User Profiles:</h3><div>from faker import Faker</div><div><br /></div><div># Create a Faker object</div><div>faker = Faker()</div><div><br /></div><div># Generate a fake user profile</div><div>fake_profile = faker.profile()</div><div>print("Fake User Profile:", fake_profile)</div><div><br /></div><div>#clcoding.com</div><div>Fake User Profile: {'job': 'Insurance claims handler', 'company': 'Mitchell-Martinez', 'ssn': '590-06-5154', 'residence': '90056 Medina Brooks\nMeyermouth, AK 19255', 'current_location': (Decimal('25.254868'), Decimal('19.597316')), 'blood_group': 'B+', 'website': ['https://johnson-bentley.com/', 'https://stevenson.com/'], 'username': 'qparker', 'name': 'Jay Sims', 'sex': 'M', 'address': '6742 Moore Fields\nMartinton, ME 47664', 'mail': 'fmiranda@hotmail.com', 'birthdate': datetime.date(1985, 8, 7)}</div></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-82304494302597910992024-03-17T19:41:00.000-07:002024-03-17T19:41:09.755-07:00Python Coding challenge - Day 151 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKARj4QLyFF5VQECQ9NYQxLjNcA5Bta38XOEOi21nYLT5d5lyBne8ykQE1S998-KTgrq8FvEs3uw1p90iEGP3mx2Xyt-aZhCfQZyROgeTZ7RaPPWraYVbGwlb02QPtQfzY8olE4Vmuyod8aXtuDJY8KokPdDT6aVtQuWj6L1HmVUw0resiMUQpYFxD_Vc/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-18T080921.516.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKARj4QLyFF5VQECQ9NYQxLjNcA5Bta38XOEOi21nYLT5d5lyBne8ykQE1S998-KTgrq8FvEs3uw1p90iEGP3mx2Xyt-aZhCfQZyROgeTZ7RaPPWraYVbGwlb02QPtQfzY8olE4Vmuyod8aXtuDJY8KokPdDT6aVtQuWj6L1HmVUw0resiMUQpYFxD_Vc/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-18T080921.516.png" /></a></div><br /><p></p><p>Let's break down the code:</p><p>s = 'clcoding'</p><p>index = s.find('n', -1) </p><p>print(index)</p><p>s = 'clcoding': This line initializes a variable s with the string 'clcoding'.</p><p>index = s.find('n', -1): This line uses the find() method on the string s. The find() method searches for the specified substring within the given string. It takes two parameters: the substring to search for and an optional parameter for the starting index. If the starting index is negative, it counts from the end of the string.</p><p>In this case, 'n' is the substring being searched for.</p><p>The starting index -1 indicates that the search should start from the end of the string.</p><p>Since the substring 'n' is not found in the string 'clcoding', the method returns -1.</p><p>print(index): This line prints the value stored in the variable index, which is the result of the find() method. In this case, it will print -1, indicating that the substring 'n' was not found in the string 'clcoding'.</p><p>So, the overall output of this code will be -1.</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-19874396333464923492024-03-16T06:27:00.000-07:002024-03-16T06:30:01.939-07:00Python Coding challenge - Day 150 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSofow6q-Jt1G-cTzf1y3mbSCSioIzDg_BBQuxdkhLo18S4sKzEMkxwZOA08nkI5i58IbQikGHLbbvzE0sLRqEPPQoCoJapAeAhW_zGJ-3J4ysvwLusNSZrVkFeCBTqjHOnoUjIbB-rKYjmBVcl03xqZRtYSbz8l1x7bCr0N08moQFTmEUYJSDirBNPwY/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-16T185630.882.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSofow6q-Jt1G-cTzf1y3mbSCSioIzDg_BBQuxdkhLo18S4sKzEMkxwZOA08nkI5i58IbQikGHLbbvzE0sLRqEPPQoCoJapAeAhW_zGJ-3J4ysvwLusNSZrVkFeCBTqjHOnoUjIbB-rKYjmBVcl03xqZRtYSbz8l1x7bCr0N08moQFTmEUYJSDirBNPwY/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-16T185630.882.png" /></a></div><br /><p></p><p><br /></p><p>Let's break down each line:</p><p>my_tuple = (1, 2, 3): This line creates a tuple named my_tuple containing three elements: 1, 2, and 3.</p><p>x, y, z, *rest = my_tuple: This line uses tuple unpacking to assign values from my_tuple to variables x, y, z, and rest. The *rest syntax is used to gather any extra elements into a list called rest.</p><p><br /></p><p>x is assigned the first element of my_tuple, which is 1.</p><p>y is assigned the second element of my_tuple, which is 2.</p><p>z is assigned the third element of my_tuple, which is 3.</p><p>*rest gathers any remaining elements of my_tuple (if any) into a list named rest. In this case, there are no remaining elements, so rest will be an empty list.</p><p>print(x, y, z, rest): This line prints the values of x, y, z, and rest.</p><p><br /></p><p>x, y, and z are the values assigned earlier, which are 1, 2, and 3 respectively.</p><p>rest is an empty list since there are no remaining elements in my_tuple.</p><p>Therefore, when you run this code, it will output:</p><p>1 2 3 []</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-33746264841637873652024-03-16T05:38:00.000-07:002024-03-16T05:53:48.096-07:00Operators - Lecture 2<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVVTClxaC6DVJ5JK3mFU_SArdJJMO_XAt5TvcM7a2yWHrM6-TojBE8Oc7vUp0b3dILUoo09MaSaBbsOtXU-j4BDnESFKGmGUpYfxeE5OYfJFQbUgXwzYIo6KnRx0_HZN_b0Jj5VSwIdtmhPJc7m7-KPu2NNcFgDnS8X15aXNsmR5hKnSrhm0-aXRWdNGo/s6912/Notes%20and%20Assignment.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="3456" data-original-width="6912" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVVTClxaC6DVJ5JK3mFU_SArdJJMO_XAt5TvcM7a2yWHrM6-TojBE8Oc7vUp0b3dILUoo09MaSaBbsOtXU-j4BDnESFKGmGUpYfxeE5OYfJFQbUgXwzYIo6KnRx0_HZN_b0Jj5VSwIdtmhPJc7m7-KPu2NNcFgDnS8X15aXNsmR5hKnSrhm0-aXRWdNGo/w640-h320/Notes%20and%20Assignment.jpg" width="640" /></a></div><br /><p></p><p><br /></p><p>Q:- What is Operator ?</p><p> Operators are symbol or special characters that perform specific</p><p>operations on one or more operands (Values or Variables).</p><p>Assignment Question</p><p>1. Write a program that prompts the user to enter their name, age, and</p><p>favorite number. Calculate and print the product of their age and</p><p>favorite number.</p><p>2. Write a program that prompts the user for enter a sentence and then</p><p>check the length of the sentence and prints the sentence also.</p><p>3. Write a program that takes two sentences from user and then checks for</p><p>the length of both sentences using “Identity Operators”.</p><p>4. Write a program that takes a integer value from the user and checks that</p><p>the number is between 10 and 20 then it will print true or else false , use</p><p>Logical and & or operator both for checking the result.</p><p>5. Write the uses of all the operators which comes inside these operators</p><p>use comments in python for writing the uses :-</p><p> Arithmetic operators</p><p> Assignment operators</p><p> Comparison operators</p><p> Logical operators</p><p> Identity operators</p><p><br /></p><iframe allow="autoplay" height="680" src="https://drive.google.com/file/d/119hzuNTUxrP2xL6rRB1JIic1T4UxsyGA/preview" width="640"></iframe>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-47008452517093130912024-03-16T05:31:00.000-07:002024-03-16T05:52:22.358-07:00Basics of Coding - Lecture 1<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvS1JW0U_vJbee2-Ct4RP_mnQ3J5GGdqd9bBE-Fss2oNYiuuSljNjdk3NeVJnqQ8AEWb7JURdBZuCICXUj_6vxjpIPvxSb1xwIOHFPWftRuOKbLcptaTgfpZTY8KoAQ88S_oZC5vyjD126cudB1a9-PeU3jUVpLu4paAUEVA_p6PvLA60ND1GI4bTZzeM/s6912/Notes%20and%20Assignment.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="3456" data-original-width="6912" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvS1JW0U_vJbee2-Ct4RP_mnQ3J5GGdqd9bBE-Fss2oNYiuuSljNjdk3NeVJnqQ8AEWb7JURdBZuCICXUj_6vxjpIPvxSb1xwIOHFPWftRuOKbLcptaTgfpZTY8KoAQ88S_oZC5vyjD126cudB1a9-PeU3jUVpLu4paAUEVA_p6PvLA60ND1GI4bTZzeM/w640-h320/Notes%20and%20Assignment.png" width="640" /></a></div><p style="text-align: justify;"><br /></p><p style="text-align: justify;">1. What is coding?</p><p style="text-align: justify;">->Coding refers to the process of creating instructions for a computer to</p><p style="text-align: justify;">perform specific tasks. It involves writing lines of code using a programming</p><p style="text-align: justify;">language that follows a defined syntax and set of rules.</p><p style="text-align: justify;">Coding can be used to create software applications, websites, algorithms, and</p><p style="text-align: justify;">much more. It is a fundamental skill in the field of computer science and in</p><p style="text-align: justify;">essential for anyone interested in software development, data analysis,</p><p style="text-align: justify;">machine learning, and various other technological domains.</p><p style="text-align: justify;">2. What is algorithm?</p><p style="text-align: justify;">->An algorithm is a set of clear and specific instructions that guide the</p><p style="text-align: justify;">computer to solve a problem or complete a task efficiently and accurately. It’s</p><p style="text-align: justify;">like a recipe that tells the computer exactly what do to achieve a desired</p><p style="text-align: justify;">outcome.</p><p style="text-align: justify;">3. Who created Python?</p><p style="text-align: justify;">-> Python was created by Guido van Rossum. He started developing Python in</p><p style="text-align: justify;">the late 1980s, and the first version of the programming language was released</p><p style="text-align: justify;">in 1991.</p><p style="text-align: justify;">4. What is Python?</p><p style="text-align: justify;">->Python is a popular and easy to learn programming language. It is known for</p><p style="text-align: justify;">it’s simplicity and readability, making it a great choice for beginners. Python is</p><p style="text-align: justify;">versatile and can be used for a wide range of tasks, from web development to</p><p style="text-align: justify;">data analysis and artificial intelligence. It’s clear syntax and extensive library</p><p style="text-align: justify;">support make it efficient and productive for software development. Overall,</p><p style="text-align: justify;">Python is a powerful yet user-friendly language that is widely used in the tech</p><p style="text-align: justify;">industry.</p><p style="text-align: justify;">Assignment Questions</p><p style="text-align: justify;">1. Declare two variables, x and y, and assign them the values 5</p><p style="text-align: justify;">and 3, respectively. Calculate their sum and print the result.</p><p style="text-align: justify;">2. Declare a variable radius and assign it a value of 7. Calculate the</p><p style="text-align: justify;">area of a circle with that radius and print the result.</p><p style="text-align: justify;"><br /></p><p style="text-align: justify;">3. Declare a variable temperature and assign it a value of 25.</p><p style="text-align: justify;">Convert the temperature from Celsius to Fahrenheit and print the</p><p style="text-align: justify;">result.</p><p style="text-align: justify;">4. Declare three variables a, b, and c and assign them the values</p><p style="text-align: justify;">10, 3.5, and 2, respectively. Calculate the result of a divided by the</p><p style="text-align: justify;">product of b and c and print the result.</p><p style="text-align: justify;">5. Declare a variable initial_amount and assign it a value of 1000.</p><p style="text-align: justify;">Calculate the compound interest after one year with an interest rate</p><p style="text-align: justify;">of 5% and print the result.</p><p style="text-align: justify;">6. Declare a variable seconds and assign it a value of 86400.</p><p style="text-align: justify;">Convert the seconds into hours, minutes, and seconds, and print the</p><p style="text-align: justify;">result in the format: "hh:mm:ss".</p><p style="text-align: justify;">7. Declare a variable numerator and assign it a value of 27.</p><p style="text-align: justify;">Declare another variable denominator and assign it a value of 4.</p><p style="text-align: justify;">Calculate the integer division and remainder of numerator divided by</p><p style="text-align: justify;">denominator and print both results.</p><p style="text-align: justify;">8. Declare a variable length and assign it a value of 10. Calculate</p><p style="text-align: justify;">the perimeter and area of a square with that length and print the</p><p style="text-align: justify;">results.</p><iframe allow="autoplay" height="680" src="https://drive.google.com/file/d/1hvxBgo5zVj6xgJByhNfVM1JeRPE_qPVZ/preview" width="640"></iframe>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-71229465204629027072024-03-15T08:10:00.000-07:002024-03-15T08:10:42.877-07:00The json library in Python <p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGKCme-ddk9hNkCy8q3ijlg8aicT-8DyuCpssqi11RobGTsCchc3Ba72OclJgx0bsBmF7id1iTgrxNPp3DYdUgbu7Ua0upCJhkNeeLf1Px-KP7WTtanvu8_eI-ngbWYPG1tW6MxkIkKXjdqx_AnMA4tsKUnvZPSJD8sX4Xd-P7D0lEj_V1rI8AFJ1TX4g/s1080/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGKCme-ddk9hNkCy8q3ijlg8aicT-8DyuCpssqi11RobGTsCchc3Ba72OclJgx0bsBmF7id1iTgrxNPp3DYdUgbu7Ua0upCJhkNeeLf1Px-KP7WTtanvu8_eI-ngbWYPG1tW6MxkIkKXjdqx_AnMA4tsKUnvZPSJD8sX4Xd-P7D0lEj_V1rI8AFJ1TX4g/s16000/1.png" /></a></div><br /><p></p><p>The json library in Python</p><h3 style="text-align: left;">1. Encoding Python Data to JSON:</h3><p>import json</p><p># Python dictionary to be encoded to JSON</p><p>data = {</p><p> "name": "John",</p><p> "age": 30,</p><p> "city": "New York"</p><p>}</p><p></p><p># Encode the Python dictionary to JSON</p><p>json_data = json.dumps(data)</p><p>print("Encoded JSON:", json_data)</p><p><br /></p><p>#clcoding.com</p><p>Encoded JSON: {"name": "John", "age": 30, "city": "New York"}</p><h3 style="text-align: left;">2. Decoding JSON to Python Data:</h3><p>import json</p><p></p><p># JSON data to be decoded to Python</p><p>json_data = '{"name": "John", "age": 30, "city": "New York"}'</p><p></p><p># Decode the JSON data to a Python dictionary</p><p>data = json.loads(json_data)</p><p></p><p>print("Decoded Python Data:", data)</p><p></p><p>#clcoding.com</p><p>Decoded Python Data: {'name': 'John', 'age': 30, 'city': 'New York'}</p><h3 style="text-align: left;">3. Reading JSON from a File:</h3><p>clcoding</p><p>import json</p><p></p><p># Read JSON data from a file</p><p>with open('clcoding.json', 'r') as file:</p><p> data = json.load(file)</p><p></p><p>print("JSON Data from File:", data)</p><p></p><p>#clcoding.com</p><p>JSON Data from File: {'We are supporting freely to everyone. Join us for live support. \n\nWhatApp Support: wa.me/919767292502\n\nInstagram Support : https://www.instagram.com/pythonclcoding/\n\nFree program: https://www.clcoding.com/\n\nFree Codes: https://clcoding.quora.com/\n\nFree Support: pythonclcoding@gmail.com\n\nLive Support: https://t.me/pythonclcoding\n\nLike us: https://www.facebook.com/pythonclcoding\n\nJoin us: https://www.facebook.com/groups/pythonclcoding': None}</p><h3 style="text-align: left;">4. Writing JSON to a File:</h3><p>import json</p><p></p><p># Python dictionary to be written to a JSON file</p><p>data = {</p><p> "name": "John",</p><p> "age": 30,</p><p> "city": "New York"</p><p>}</p><p></p><p># Write the Python dictionary to a JSON file</p><p>with open('output.json', 'w') as file:</p><p> json.dump(data, file)</p><p></p><p> #clcoding.com</p><h3 style="text-align: left;">5. Handling JSON Errors:</h3><p>import json</p><p></p><p># JSON data with syntax error</p><p>json_data = '{"name": "John", "age": 30, "city": "New York"'</p><p></p><p>try:</p><p> # Attempt to decode JSON data</p><p> data = json.loads(json_data)</p><p>except json.JSONDecodeError as e:</p><p> # Handle JSON decoding error</p><p> print("Error decoding JSON:", e)</p><p></p><p> #clcoding.com</p><p>Error decoding JSON: Expecting ',' delimiter: line 1 column 47 (char 46)</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-8934209383038714402024-03-14T20:32:00.000-07:002024-03-14T20:32:54.021-07:00Python Coding challenge - Day 149 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsFLcha9A__pjyoRF8jHnV5LSJDanwGEuFTFbj5LTUhgJqGrGHeyysHjmQWj9ZEaqLM0DGXQmd31Kq2dl84RHrEo99Wq5SfAy53GhHU2nlF5NprtZmMmslrWsLftgIlz8YsW43ugjqaFv1PDGbBiOUSPX_tCbJyWaWEoYh8c7GckNU8Qb2UP52AFA3lZU/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-15T090107.982.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsFLcha9A__pjyoRF8jHnV5LSJDanwGEuFTFbj5LTUhgJqGrGHeyysHjmQWj9ZEaqLM0DGXQmd31Kq2dl84RHrEo99Wq5SfAy53GhHU2nlF5NprtZmMmslrWsLftgIlz8YsW43ugjqaFv1PDGbBiOUSPX_tCbJyWaWEoYh8c7GckNU8Qb2UP52AFA3lZU/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-15T090107.982.png" /></a></div><br /><p></p><p>Let's break down the given code:</p><p>for i in range(1, 3):</p><p> print(i, end=' - ')</p><p>This code snippet is a for loop in Python. Let's go through it step by step:</p><p>for i in range(1, 3)::</p><p>This line initiates a loop where i will take on values from 1 to 2 (inclusive). The range() function generates a sequence of numbers starting from the first argument (1 in this case) up to, but not including, the second argument (3 in this case).</p><p>So, the loop will iterate with i taking on the values 1 and 2.</p><p>print(i, end=' - '):</p><p>Within the loop, this line prints the current value of i, followed by a dash (-), without moving to the next line due to the end=' - ' parameter.</p><p>So, during each iteration of the loop, it will print the value of i followed by a dash and space.</p><p>When you execute this code, it will output:</p><p>1 - 2 - </p><p>Explanation: The loop runs for each value of i in the range (1, 3), which are 1 and 2. For each value of i, it prints the value followed by a dash and space. So, the output is 1 - 2 - .</p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-82834763028275198532024-03-14T08:34:00.000-07:002024-03-14T08:35:18.798-07:00Learn hashlib library in Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD5uVtrNYyOVPHs2PCTO8tt90jhEnsLSGmko4J7ZSOjCXxlaIrT54gpbSdFG6LtL2vZN52UhZT9PuXMrai60YkMHaMIanHCOuhlL65orJdxidR91Ce_gZ2bJMalOHrVZd574B-ByJtpMg6_hhgZM0iYFXe44emRPjlutMsrVU8_TDG4ekTD2CR8xMrXxw/s1080/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD5uVtrNYyOVPHs2PCTO8tt90jhEnsLSGmko4J7ZSOjCXxlaIrT54gpbSdFG6LtL2vZN52UhZT9PuXMrai60YkMHaMIanHCOuhlL65orJdxidR91Ce_gZ2bJMalOHrVZd574B-ByJtpMg6_hhgZM0iYFXe44emRPjlutMsrVU8_TDG4ekTD2CR8xMrXxw/s16000/1.png" /></a></div><br /><p></p><h3 style="text-align: left;">1. Hashing Strings:</h3><p>import hashlib</p><p># Hash a string using SHA256 algorithm</p><p>string_to_hash = "Hello, World!"</p><p>hashed_string = hashlib.sha256(string_to_hash.encode()).hexdigest()</p><p>print("Original String:", string_to_hash)</p><p>print("Hashed String:", hashed_string)</p><p></p><p>#clcoding.com </p><p>Original String: Hello, World!</p><p>Hashed String: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f</p><h3 style="text-align: left;">2. Hashing Files:</h3><p>#clcoding.com </p><p>import hashlib</p><p></p><p>def calculate_file_hash(file_path, algorithm='sha256'):</p><p> # Choose the hash algorithm</p><p> hash_algorithm = getattr(hashlib, algorithm)()</p><p></p><p> # Read the file in binary mode and update the hash object</p><p> with open(file_path, 'rb') as file:</p><p> for chunk in iter(lambda: file.read(4096), b''):</p><p> hash_algorithm.update(chunk)</p><p></p><p> # Get the hexadecimal representation of the hash value</p><p> hash_value = hash_algorithm.hexdigest()</p><p> return hash_value</p><p></p><p># Example usage</p><p>file_path = 'example.txt'</p><p>file_hash = calculate_file_hash(file_path)</p><p>print("SHA-256 Hash of the file:", file_hash)</p><p></p><p>#clcoding.com </p><p>SHA-256 Hash of the file: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</p><h3 style="text-align: left;">3. Using Different Hash Algorithms:</h3><p>import hashlib</p><p># Hash a string using different algorithms</p><p>string_to_hash = "Hello, World!"</p><p></p><p># MD5</p><p>md5_hash = hashlib.md5(string_to_hash.encode()).hexdigest()</p><p></p><p># SHA1</p><p>sha1_hash = hashlib.sha1(string_to_hash.encode()).hexdigest()</p><p></p><p># SHA512</p><p>sha512_hash = hashlib.sha512(string_to_hash.encode()).hexdigest()</p><p></p><p>print("MD5 Hash:", md5_hash)</p><p>print("SHA1 Hash:", sha1_hash)</p><p>print("SHA512 Hash:", sha512_hash)</p><p></p><p>#clcoding.com </p><p>MD5 Hash: 65a8e27d8879283831b664bd8b7f0ad4</p><p>SHA1 Hash: 0a0a9f2a6772942557ab5355d76af442f8f65e01</p><p>SHA512 Hash: 374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387</p><h3 style="text-align: left;">4. Hashing Passwords (Securely):</h3><p>import hashlib</p><p># Hash a password securely using a salt</p><p>password = "my_password"</p><p>salt = "random_salt"</p><p><br /></p><p>hashed_password = hashlib.pbkdf2_hmac('sha256', password.encode(), salt.encode(), 100000)</p><p>hashed_password_hex = hashed_password.hex()</p><p></p><p>print("Salted and Hashed Password:", hashed_password_hex)</p><p><br /></p><p>#clcoding.com </p><p>Salted and Hashed Password: b18597b62cda4415c995eaff30f61460da8ff4d758d3880f80593ed5866dcf98</p><h3 style="text-align: left;">5. Verifying Passwords:</h3><p>import hashlib</p><p></p><p># Verify a password against a stored hash</p><p>stored_hash = "stored_hashed_password"</p><p></p><p>def verify_password(password, stored_hash):</p><p> input_hash = hashlib.sha256(password.encode()).hexdigest()</p><p> if input_hash == stored_hash:</p><p> return True</p><p> else:</p><p> return False</p><p></p><p>password_to_verify = "password_to_verify"</p><p>if verify_password(password_to_verify, stored_hash):</p><p> print("Password is correct!")</p><p>else:</p><p> print("Password is incorrect.")</p><p> </p><p>#clcoding.com </p><p>Password is incorrect.</p><h3 style="text-align: left;">6. Hashing a String using SHA-256:</h3><p>import hashlib</p><p></p><p># Create a hash object</p><p>hash_object = hashlib.sha256()</p><p></p><p># Update the hash object with the input data</p><p>input_data = b'Hello, World!'</p><p>hash_object.update(input_data)</p><p></p><p># Get the hexadecimal representation of the hash value</p><p>hash_value = hash_object.hexdigest()</p><p></p><p>print("SHA-256 Hash:", hash_value)</p><p></p><p>#clcoding.com </p><p>SHA-256 Hash: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f</p><h3 style="text-align: left;">7. Hashing a String using MD5:</h3><p>import hashlib</p><p># Create a hash object</p><p>hash_object = hashlib.md5()</p><p></p><p># Update the hash object with the input data</p><p>input_data = b'Hello, World!'</p><p>hash_object.update(input_data)</p><p></p><p># Get the hexadecimal representation of the hash value</p><p>hash_value = hash_object.hexdigest()</p><p></p><p>print("MD5 Hash:", hash_value)</p><p></p><p>#clcoding.com </p><p>MD5 Hash: 65a8e27d8879283831b664bd8b7f0ad4</p><p></p><p><br /></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-72932478630418074962024-03-13T09:00:00.000-07:002024-03-13T09:01:38.949-07:00Learn psutil library in Python 🧵:<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_22LcYOCKJ9_9fwid-EJua6eq2_YUpMuV0Ojg-3iO0vV5p-md2kN3gQO_EZlwlx7V0U5gP9MGORvRbZbYaNMYYdpoENTE_XuV7tmK1-6B9bgxAHPGgnR3zNqGRDTiPcthOd3xCOPKOzQwV2LPJA3XVzWGyOUQT0z5lBwGCMb6bYRkA-BbXTN0XG3oREI/s1080/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_22LcYOCKJ9_9fwid-EJua6eq2_YUpMuV0Ojg-3iO0vV5p-md2kN3gQO_EZlwlx7V0U5gP9MGORvRbZbYaNMYYdpoENTE_XuV7tmK1-6B9bgxAHPGgnR3zNqGRDTiPcthOd3xCOPKOzQwV2LPJA3XVzWGyOUQT0z5lBwGCMb6bYRkA-BbXTN0XG3oREI/s16000/1.png" /></a></div><br /><p></p><p>Learn psutil library in Python</p><p>pip install psutil</p><h3 style="text-align: left;">1. Getting CPU Information:</h3><p>import psutil</p><p># Get CPU information</p><p>cpu_count = psutil.cpu_count()</p><p>cpu_percent = psutil.cpu_percent(interval=1)</p><p><br /></p><p>print("CPU Count:", cpu_count)</p><p>print("CPU Percent:", cpu_percent)</p><p><br /></p><p>#clcoding.com </p><p>CPU Count: 8</p><p>CPU Percent: 6.9</p><h3 style="text-align: left;">2. Getting Memory Information:</h3><p>import psutil</p><p></p><p># Get memory information</p><p>memory = psutil.virtual_memory()</p><p></p><p>total_memory = memory.total</p><p>available_memory = memory.available</p><p>used_memory = memory.used</p><p>percent_memory = memory.percent</p><p></p><p>print("Total Memory:", total_memory)</p><p>print("Available Memory:", available_memory)</p><p>print("Used Memory:", used_memory)</p><p>print("Memory Percent:", percent_memory)</p><p></p><p>#clcoding.com</p><p>Total Memory: 8446738432</p><p>Available Memory: 721600512</p><p>Used Memory: 7725137920</p><p>Memory Percent: 91.5</p><h3 style="text-align: left;">3. Listing Running Processes:</h3><p>import psutil</p><p></p><p># List running processes</p><p>for process in psutil.process_iter():</p><p> print(process.pid, process.name())</p><p></p><p> #clcoding.com</p><p>0 System Idle Process</p><p>4 System</p><p>124 Registry</p><p>252 chrome.exe</p><p>408 PowerToys.Peek.UI.exe</p><p>436 msedge.exe</p><p>452 svchost.exe</p><p>504 smss.exe</p><p>520 svchost.exe</p><p>532 RuntimeBroker.exe</p><p>544 TextInputHost.exe</p><p>548 svchost.exe</p><p>680 csrss.exe</p><p>704 fontdrvhost.exe</p><p>768 wininit.exe</p><p>776 chrome.exe</p><p>804 chrome.exe</p><p>848 services.exe</p><p>924 lsass.exe</p><p>1036 WUDFHost.exe</p><p>1100 svchost.exe</p><p>1148 svchost.exe</p><p>1160 SgrmBroker.exe</p><p>1260 dllhost.exe</p><p>1284 PowerToys.exe</p><p>1328 svchost.exe</p><p>1392 svchost.exe</p><p>1400 svchost.exe</p><p>1408 svchost.exe</p><p>1488 svchost.exe</p><p>1504 svchost.exe</p><p>1512 svchost.exe</p><p>1600 SmartAudio3.exe</p><p>1608 svchost.exe</p><p>1668 svchost.exe</p><p>1716 svchost.exe</p><p>1724 IntelCpHDCPSvc.exe</p><p>1732 svchost.exe</p><p>1752 svchost.exe</p><p>1796 TiWorker.exe</p><p>1828 svchost.exe</p><p>1920 chrome.exe</p><p>1972 svchost.exe</p><p>1992 svchost.exe</p><p>2016 svchost.exe</p><p>2052 svchost.exe</p><p>2060 svchost.exe</p><p>2068 IntelCpHeciSvc.exe</p><p>2148 igfxCUIService.exe</p><p>2168 svchost.exe</p><p>2224 svchost.exe</p><p>2260 svchost.exe</p><p>2316 svchost.exe</p><p>2360 chrome.exe</p><p>2364 svchost.exe</p><p>2400 MsMpEng.exe</p><p>2420 svchost.exe</p><p>2428 svchost.exe</p><p>2448 PowerToys.FancyZones.exe</p><p>2480 screenrec.exe</p><p>2488 svchost.exe</p><p>2496 svchost.exe</p><p>2504 svchost.exe</p><p>2552 svchost.exe</p><p>2604 svchost.exe</p><p>2616 MemCompression</p><p>2716 svchost.exe</p><p>2792 chrome.exe</p><p>2796 dasHost.exe</p><p>2804 chrome.exe</p><p>2852 svchost.exe</p><p>2876 svchost.exe</p><p>2932 CxAudioSvc.exe</p><p>3016 svchost.exe</p><p>3240 svchost.exe</p><p>3416 svchost.exe</p><p>3480 svchost.exe</p><p>3536 spoolsv.exe</p><p>3620 svchost.exe</p><p>3660 svchost.exe</p><p>3700 svchost.exe</p><p>3752 RuntimeBroker.exe</p><p>3848 taskhostw.exe</p><p>3976 svchost.exe</p><p>3984 svchost.exe</p><p>3992 svchost.exe</p><p>4000 svchost.exe</p><p>4008 svchost.exe</p><p>4016 svchost.exe</p><p>4024 svchost.exe</p><p>4032 svchost.exe</p><p>4100 svchost.exe</p><p>4132 OneApp.IGCC.WinService.exe</p><p>4140 AnyDesk.exe</p><p>4148 armsvc.exe</p><p>4156 CxUtilSvc.exe</p><p>4208 WMIRegistrationService.exe</p><p>4284 msedge.exe</p><p>4312 svchost.exe</p><p>4320 AGMService.exe</p><p>4340 svchost.exe</p><p>4488 chrome.exe</p><p>4516 svchost.exe</p><p>4584 svchost.exe</p><p>4720 jhi_service.exe</p><p>4928 chrome.exe</p><p>5004 chrome.exe</p><p>5176 dwm.exe</p><p>5348 svchost.exe</p><p>5368 Flow.exe</p><p>5380 svchost.exe</p><p>5536 chrome.exe</p><p>5540 chrome.exe</p><p>5584 audiodg.exe</p><p>5620 svchost.exe</p><p>5724 svchost.exe</p><p>5776 svchost.exe</p><p>5992 ctfmon.exe</p><p>6032 CompPkgSrv.exe</p><p>6056 SearchProtocolHost.exe</p><p>6076 msedge.exe</p><p>6120 SearchIndexer.exe</p><p>6128 RuntimeBroker.exe</p><p>6156 svchost.exe</p><p>6192 MoUsoCoreWorker.exe</p><p>6380 PowerToys.PowerLauncher.exe</p><p>6424 PowerToys.Awake.exe</p><p>6480 msedge.exe</p><p>6596 svchost.exe</p><p>6740 svchost.exe</p><p>6792 winlogon.exe</p><p>6856 TrustedInstaller.exe</p><p>6872 svchost.exe</p><p>6888 igfxEM.exe</p><p>6908 svchost.exe</p><p>6948 chrome.exe</p><p>7140 csrss.exe</p><p>7296 PowerToys.KeyboardManagerEngine.exe</p><p>7336 WhatsApp.exe</p><p>7348 chrome.exe</p><p>7416 chrome.exe</p><p>7440 MusNotifyIcon.exe</p><p>7444 StartMenuExperienceHost.exe</p><p>7480 svchost.exe</p><p>7520 chrome.exe</p><p>7556 SearchApp.exe</p><p>7560 SecurityHealthService.exe</p><p>7720 msedge.exe</p><p>8220 MmReminderService.exe</p><p>8316 RuntimeBroker.exe</p><p>8636 svchost.exe</p><p>8836 python.exe</p><p>9088 ShellExperienceHost.exe</p><p>9284 svchost.exe</p><p>9344 NisSrv.exe</p><p>9560 msedge.exe</p><p>9664 chrome.exe</p><p>9736 chrome.exe</p><p>9784 SearchApp.exe</p><p>9808 svchost.exe</p><p>9868 python.exe</p><p>9884 svchost.exe</p><p>9908 chrome.exe</p><p>9936 chrome.exe</p><p>9996 QtWebEngineProcess.exe</p><p>10012 taskhostw.exe</p><p>10024 chrome.exe</p><p>10148 svchost.exe</p><p>10228 svchost.exe</p><p>10236 PowerToys.CropAndLock.exe</p><p>10304 Taskmgr.exe</p><p>10324 Video.UI.exe</p><p>10584 svchost.exe</p><p>10680 chrome.exe</p><p>10920 LockApp.exe</p><p>11064 chrome.exe</p><p>11176 chrome.exe</p><p>11188 msedge.exe</p><p>11396 msedge.exe</p><p>11500 QtWebEngineProcess.exe</p><p>11592 svchost.exe</p><p>12132 msedge.exe</p><p>12212 RuntimeBroker.exe</p><p>12360 RuntimeBroker.exe</p><p>12500 chrome.exe</p><p>12596 python.exe</p><p>12704 chrome.exe</p><p>12744 svchost.exe</p><p>12832 svchost.exe</p><p>12848 MicTray64.exe</p><p>12852 fontdrvhost.exe</p><p>12992 chrome.exe</p><p>13092 chrome.exe</p><p>13268 chrome.exe</p><p>13332 chrome.exe</p><p>13388 sihost.exe</p><p>13572 chrome.exe</p><p>13760 SecurityHealthSystray.exe</p><p>13792 msedge.exe</p><p>13880 fodhelper.exe</p><p>13900 chrome.exe</p><p>14160 UserOOBEBroker.exe</p><p>14220 RuntimeBroker.exe</p><p>14260 chrome.exe</p><p>14356 msedge.exe</p><p>14572 chrome.exe</p><p>14648 chrome.exe</p><p>14696 PowerToys.AlwaysOnTop.exe</p><p>14852 chrome.exe</p><p>14868 PowerToys.ColorPickerUI.exe</p><p>14876 conhost.exe</p><p>14888 PowerToys.PowerOCR.exe</p><p>14948 chrome.exe</p><p>15324 explorer.exe</p><h3 style="text-align: left;">4. Getting Process Information:</h3><p>252</p><p>import psutil</p><p></p><p># Get information for a specific process</p><p>pid = 252 # Replace with the process ID of interest</p><p>process = psutil.Process(pid)</p><p></p><p>print("Process Name:", process.name())</p><p>print("Process Status:", process.status())</p><p>print("Process CPU Percent:", process.cpu_percent(interval=1))</p><p>print("Process Memory Info:", process.memory_info())</p><p></p><p>#clcoding.com</p><p>Process Name: chrome.exe</p><p>Process Status: running</p><p>Process CPU Percent: 0.0</p><p>Process Memory Info: pmem(rss=29597696, vms=24637440, num_page_faults=14245, peak_wset=37335040, wset=29597696, peak_paged_pool=635560, paged_pool=635560, peak_nonpaged_pool=21344, nonpaged_pool=17536, pagefile=24637440, peak_pagefile=33103872, private=24637440)</p><h3 style="text-align: left;">5. Killing a Process:</h3><p>import psutil</p><p># Kill a process</p><p>pid_to_kill = 10088 </p><p># Replace with the process ID to kill</p><p>process_to_kill = psutil.Process(pid_to_kill)</p><p>process_to_kill.terminate()</p><p></p><p>#clcoding.com</p><h3 style="text-align: left;">6. Getting Disk Usage:</h3><p>import psutil</p><p></p><p># Get disk usage information</p><p>disk_usage = psutil.disk_usage('/')</p><p></p><p>total_disk_space = disk_usage.total</p><p>used_disk_space = disk_usage.used</p><p>free_disk_space = disk_usage.free</p><p>disk_usage_percent = disk_usage.percent</p><p></p><p>print("Total Disk Space:", total_disk_space)</p><p>print("Used Disk Space:", used_disk_space)</p><p>print("Free Disk Space:", free_disk_space)</p><p>print("Disk Usage Percent:", disk_usage_percent)</p><p></p><p>#clcoding.com</p><p>Total Disk Space: 479491600384</p><p>Used Disk Space: 414899838976</p><p>Free Disk Space: 64591761408</p><p>Disk Usage Percent: 86.5</p><p></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-52307769912640141112024-03-12T21:17:00.000-07:002024-03-12T21:17:35.064-07:00Python Coding challenge - Day 148 | What is the output of the following Python Code?<p><br /><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7JwRgKnJye_LkyaLRAorl7vBBdmRYIkkvLrhofkdnaswiBRpaTJVNwnK4etRcsp5cnwv_wkiel49ZK1DBJR-zfnkJD_IFhJwiWS6YLXB2tZRg6vZwkU5ZHzLWIIyLTqnFKHv3uUSf6fl_fyaiEWy2860PivjQozrOxi-XbyqFSB5-iOWXRaNU8eg-yjw/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-13T083415.666.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7JwRgKnJye_LkyaLRAorl7vBBdmRYIkkvLrhofkdnaswiBRpaTJVNwnK4etRcsp5cnwv_wkiel49ZK1DBJR-zfnkJD_IFhJwiWS6YLXB2tZRg6vZwkU5ZHzLWIIyLTqnFKHv3uUSf6fl_fyaiEWy2860PivjQozrOxi-XbyqFSB5-iOWXRaNU8eg-yjw/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-13T083415.666.png" /></a></div><br /><p><br /></p><p>Let's break down the provided code:</p><p>d = {'Milk': 1, 'Soap': 2, 'Towel': 3}</p><p>if 'Soap' in d:</p><p> print(d['Soap'])</p><p>d = {'Milk': 1, 'Soap': 2, 'Towel': 3}: This line initializes a dictionary named d with three key-value pairs. Each key represents an item, and its corresponding value represents the quantity of that item. In this case, there are items such as 'Milk', 'Soap', and 'Towel', each associated with a quantity.</p><p>if 'Soap' in d:: This line checks whether the key 'Soap' exists in the dictionary d. It does this by using the in keyword to check if the string 'Soap' is a key in the dictionary. If 'Soap' is present in the dictionary d, the condition evaluates to True, and the code inside the if block will execute.</p><p>print(d['Soap']): If the key 'Soap' exists in the dictionary d, this line will execute. It retrieves the value associated with the key 'Soap' from the dictionary d and prints it. In this case, the value associated with 'Soap' is 2, so it will print 2.</p><p>So, in summary, this code checks if the dictionary contains an entry for 'Soap'. If it does, it prints the quantity of soap available (which is 2 in this case).</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-60640055431225174392024-03-12T09:46:00.000-07:002024-03-12T09:46:14.017-07:00Plots using Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTCQ2uM2aKDajlumkYu7LjQfnJH6P1GZk95VBc5MNP99EhgL0MGkpCSWZytztm6uPNhTFvc-WCiAJfkMagAAUpAWGMgUGZF3iMmNdXF2oEOKrvdmEhRnmC4oTo7G9_wk-Kzd3S_lnD9v_i_lGhILaxzPtjTgpsKZrTwFwtxk3nJuQXBNSRVyhqgAIfZNw/s1080/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTCQ2uM2aKDajlumkYu7LjQfnJH6P1GZk95VBc5MNP99EhgL0MGkpCSWZytztm6uPNhTFvc-WCiAJfkMagAAUpAWGMgUGZF3iMmNdXF2oEOKrvdmEhRnmC4oTo7G9_wk-Kzd3S_lnD9v_i_lGhILaxzPtjTgpsKZrTwFwtxk3nJuQXBNSRVyhqgAIfZNw/s16000/1.png" /></a></div><br /><p></p><p>1. Line Plot:</p><p>#clcoding.com</p><p>import matplotlib.pyplot as plt</p><p></p><p># Sample data</p><p>x = [1, 2, 3, 4, 5]</p><p>y = [2, 4, 6, 8, 10]</p><p></p><p># Create a line plot</p><p>plt.plot(x, y)</p><p>plt.xlabel('X-axis')</p><p>plt.ylabel('Y-axis')</p><p>plt.title('Line Plot Example')</p><p>plt.show()</p><p></p><p>#clcoding.com</p><p><br /></p><p>2. Bar Plot:</p><p>import matplotlib.pyplot as plt</p><p></p><p># Sample data</p><p>categories = ['A', 'B', 'C', 'D']</p><p>values = [10, 20, 15, 25]</p><p></p><p># Create a bar plot</p><p>plt.bar(categories, values)</p><p>plt.xlabel('Categories')</p><p>plt.ylabel('Values')</p><p>plt.title('Bar Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>3. Histogram:</p><p>import matplotlib.pyplot as plt</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>data = np.random.randn(1000)</p><p></p><p># Create a histogram</p><p>plt.hist(data, bins=30)</p><p>plt.xlabel('Values')</p><p>plt.ylabel('Frequency')</p><p>plt.title('Histogram Example')</p><p>plt.show()</p><p></p><p><br /></p><p>4. Scatter Plot:</p><p>import matplotlib.pyplot as plt</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>x = np.random.randn(100)</p><p>y = 2 * x + np.random.randn(100)</p><p></p><p># Create a scatter plot</p><p>plt.scatter(x, y)</p><p>plt.xlabel('X-axis')</p><p>plt.ylabel('Y-axis')</p><p>plt.title('Scatter Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>5. Box Plot:</p><p>import seaborn as sns</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>data = np.random.randn(100)</p><p></p><p># Create a box plot</p><p>sns.boxplot(data=data)</p><p>plt.title('Box Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>6. Violin Plot:</p><p>import seaborn as sns</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>data = np.random.randn(100)</p><p></p><p># Create a violin plot</p><p>sns.violinplot(data=data)</p><p>plt.title('Violin Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>7. Heatmap:</p><p>#clcoding.com</p><p>import seaborn as sns</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>data = np.random.rand(10, 10)</p><p>#clcoding.com</p><p># Create a heatmap</p><p>sns.heatmap(data)</p><p>plt.title('Heatmap Example')</p><p>plt.show()</p><p></p><p><br /></p><p>8. Area Plot:</p><p>import matplotlib.pyplot as plt</p><p></p><p># Sample data #clcoding.com</p><p>x = [1, 2, 3, 4, 5]</p><p>y1 = [2, 4, 6, 8, 10]</p><p>y2 = [1, 3, 5, 7, 9]</p><p></p><p># Create an area plot</p><p>plt.fill_between(x, y1, color="skyblue", alpha=0.4)</p><p>plt.fill_between(x, y2, color="salmon", alpha=0.4)</p><p>plt.xlabel('X-axis')</p><p>plt.ylabel('Y-axis')</p><p>plt.title('Area Plot Example')</p><p>plt.show()</p><p><br /></p><p>9. Pie Chart:</p><p>import matplotlib.pyplot as plt</p><p></p><p># Sample data</p><p>sizes = [30, 20, 25, 15, 10]</p><p>labels = ['A', 'B', 'C', 'D', 'E']</p><p></p><p># Create a pie chart</p><p>plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)</p><p>plt.title('Pie Chart Example')</p><p>plt.show()</p><p></p><p><br /></p><p>10. Polar Plot:</p><p>g</p><p>import matplotlib.pyplot as plt</p><p>import numpy as np</p><p></p><p># Sample data</p><p>theta = np.linspace(0, 2*np.pi, 100)</p><p>r = np.sin(3*theta)</p><p></p><p># Create a polar plot #clcoding.com</p><p>plt.polar(theta, r)</p><p>plt.title('Polar Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>11. 3D Plot:</p><p>import matplotlib.pyplot as plt</p><p>import numpy as np</p><p></p><p># Sample data</p><p>x = np.linspace(-5, 5, 100)</p><p>y = np.linspace(-5, 5, 100)</p><p>X, Y = np.meshgrid(x, y)</p><p>Z = np.sin(np.sqrt(X**2 + Y**2))</p><p></p><p># Create a 3D surface plot</p><p>fig = plt.figure()</p><p>ax = fig.add_subplot(111, projection='3d')</p><p>ax.plot_surface(X, Y, Z)</p><p>ax.set_title('3D Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>12. Violin Swarm Plot:</p><p>#clcoding.com</p><p>import seaborn as sns</p><p>import numpy as np</p><p></p><p># Generate random data</p><p>data = np.random.randn(100)</p><p>#clcoding.com</p><p># Create a violin swarm plot</p><p>sns.violinplot(data=data, inner=None, color='lightgray')</p><p>sns.swarmplot(data=data, color='blue', alpha=0.5)</p><p>plt.title('Violin Swarm Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p>13. Pair Plot:</p><p>import seaborn as sns</p><p>import pandas as pd</p><p></p><p># Load sample dataset</p><p>iris = sns.load_dataset('iris')</p><p></p><p># Create a pair plot</p><p>sns.pairplot(iris)</p><p>plt.title('Pair Plot Example')</p><p>plt.show()</p><p></p><p><br /></p><p></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-91279199429719906052024-03-11T18:59:00.000-07:002024-03-11T18:59:17.216-07:00Python Coding challenge - Day 147 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSj_dMVFvMWoeX1LhMmJS8d2wnql_Fnfnhdkbn_vCpPvmBVQYQmHqm9VIC7E62auW-jn2D0lGBbAO9gNLLy_2_bG6rUyL7zigIUqHHYnhgbKtlM_3phgo0I43n8kD3CPurXidQvWfrI7DPJkaBgxu03tJDn5qw1KZjJk7RNEGByXOfi5a_i_aGaGeRChg/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-12T072709.327.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSj_dMVFvMWoeX1LhMmJS8d2wnql_Fnfnhdkbn_vCpPvmBVQYQmHqm9VIC7E62auW-jn2D0lGBbAO9gNLLy_2_bG6rUyL7zigIUqHHYnhgbKtlM_3phgo0I43n8kD3CPurXidQvWfrI7DPJkaBgxu03tJDn5qw1KZjJk7RNEGByXOfi5a_i_aGaGeRChg/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-12T072709.327.png" /></a></div><br /><p></p><p>In Python, the is operator checks whether two variables reference the same object in memory, while the == operator checks for equality of values. Now, let's analyze the given code:</p><p>g = (1, 2, 3)</p><p>h = (1, 2, 3)</p><p>print(f"g is h: {g is h}")</p><p>print(f"g == h: {g == h}")</p><p>Explanation:</p><p>Identity (is):</p><p>The g is h expression checks if g and h refer to the same object in memory.</p><p>In this case, since tuples are immutable, Python creates separate objects for g and h with the same values (1, 2, 3).</p><p>Equality (==):</p><p><br /></p><p>The g == h expression checks if the values contained in g and h are the same.</p><p>Tuples are compared element-wise. In this case, both tuples have the same elements (1, 2, 3).</p><p>Output:</p><p>The output of the code will be:</p><p>g is h: False</p><p>g == h: True</p><p>Explanation of Output:</p><p>g is h: False: The is operator returns False because g and h are distinct objects in memory.</p><p>g == h: True: The == operator returns True because the values inside g and h are the same.</p><p>In summary, the tuples g and h are different objects in memory, but they contain the same values, leading to == evaluating to True.</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-3200074773444490692024-03-11T09:54:00.000-07:002024-03-11T18:28:23.379-07:00Cybersecurity using Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6ObJynOohX09A2txFMJE8tvqJYdEB-x0uAdoZvziMf1vR_3-NftuI3oawfs8sKciPcCLmbWpsKohGN_Jg1dmnxtNHmezcmhCsfvawJHekP1klclIj0__tDlTrNRfwCtq8qoEoUKYSqTRVO1-1XdT7rRefvDIkgVu9sEu4unM-i3ilJCAAUlCT0Nqawks/s1080/1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6ObJynOohX09A2txFMJE8tvqJYdEB-x0uAdoZvziMf1vR_3-NftuI3oawfs8sKciPcCLmbWpsKohGN_Jg1dmnxtNHmezcmhCsfvawJHekP1klclIj0__tDlTrNRfwCtq8qoEoUKYSqTRVO1-1XdT7rRefvDIkgVu9sEu4unM-i3ilJCAAUlCT0Nqawks/s16000/1.png" /></a></div><br /><p></p><h3 style="text-align: left;">1. Hashing Passwords:</h3><p>import hashlib</p><p></p><p>def hash_password(password):</p><p> hashed_password = hashlib.sha256(password.encode()).hexdigest()</p><p> return hashed_password</p><p></p><p># Example</p><p>password = "my_secure_password"</p><p>hashed_password = hash_password(password)</p><p>print("Hashed Password:", hashed_password)</p><p></p><p>#clcoding.com </p><p>Hashed Password: 2c9a8d02fc17ae77e926d38fe83c3529d6638d1d636379503f0c6400e063445f</p><h3 style="text-align: left;">2. Generating Random Passwords:</h3><p>import random</p><p>import string</p><p></p><p>def generate_random_password(length=12):</p><p> characters = string.ascii_letters + string.digits + string.punctuation</p><p> password = ''.join(random.choice(characters) for _ in range(length))</p><p> return password</p><p></p><p># Example</p><p>random_password = generate_random_password()</p><p>print("Random Password:", random_password)</p><p></p><p>#clcoding.com </p><p>Random Password: zH7~ANoO:7#S</p><h3 style="text-align: left;">3. Network Scanning with Scapy:</h3><p>from scapy.all import IP, ICMP, sr1</p><p></p><p>def ping(host):</p><p> packet = IP(dst=host)/ICMP()</p><p> response = sr1(packet, timeout=2, verbose=0)</p><p> if response:</p><p> return f"{host} is online"</p><p> else:</p><p> return f"{host} is offline"</p><p></p><p># Example</p><p>host_to_scan = "example.com"</p><p>result = ping(host_to_scan)</p><p>print(result)</p><p></p><p>#clcoding.com</p><h3 style="text-align: left;">4. Web Scraping for Security Research:</h3><p>import requests</p><p>from bs4 import BeautifulSoup</p><p></p><p>def scrape_security_news():</p><p> url = "https://example-security-news.com"</p><p> response = requests.get(url)</p><p> soup = BeautifulSoup(response.text, 'html.parser')</p><p> headlines = soup.find_all('h2', class_='security-headline')</p><p> return [headline.text for headline in headlines]</p><p></p><p># Example</p><p>security_headlines = scrape_security_news()</p><p>print("Security Headlines:", security_headlines)</p><p></p><p>#clcoding.com</p><h3 style="text-align: left;">5. Password Cracking Simulation:</h3><p>import hashlib</p><p></p><p>def simulate_password_cracking(hashed_password, password_list):</p><p> for password in password_list:</p><p> if hashlib.sha256(password.encode()).hexdigest() == hashed_password:</p><p> return f"Password cracked: {password}"</p><p> return "Password not found"</p><p></p><p># Example</p><p>hashed_password_to_crack = "d033e22ae348aeb5660fc2140aec35850c4da997"</p><p>common_passwords = ["password", "123456", "qwerty", "admin"]</p><p></p><p>result = simulate_password_cracking(hashed_password_to_crack, common_passwords)</p><p>print(result)</p><p></p><p>#clcoding.com</p><h3 style="text-align: left;">6. Secure File Handling:</h3><p>import os</p><p>def secure_file_deletion(file_path):</p><p> with open(file_path, 'w') as file:</p><p> file.write(os.urandom(1024)) </p><p> # Overwrite the file with random data</p><p> os.remove(file_path)</p><p> print(f"{file_path} securely deleted")</p><p># Example</p><p>file_path_to_delete = "example.txt"</p><p>secure_file_deletion(file_path_to_delete)</p><p>#clcoding.com</p><p><br /></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-30155144365693438242024-03-10T19:15:00.000-07:002024-03-10T19:15:50.271-07:00Python Coding challenge - Day 146 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYfnKxc6r_KnIHlM5S6UViLAoXSKAIenpxANg7EsgAAIc7rH_0JJZMTvHWzV3x2gurIjpQYj5Zn_nCxw2vYw6VNUHUfTep8B31kwxVV_S2o40q_QebsuOmqQJXe64zkAnfWaNojtTUaJCyk4CaWR5ECGaLxDNh3zCFCBnvQyhNNGVDSvkiQV7aH1JWJko/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-11T074432.341.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYfnKxc6r_KnIHlM5S6UViLAoXSKAIenpxANg7EsgAAIc7rH_0JJZMTvHWzV3x2gurIjpQYj5Zn_nCxw2vYw6VNUHUfTep8B31kwxVV_S2o40q_QebsuOmqQJXe64zkAnfWaNojtTUaJCyk4CaWR5ECGaLxDNh3zCFCBnvQyhNNGVDSvkiQV7aH1JWJko/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-11T074432.341.png" /></a></div><br /><p></p><p>Let's go through the code step by step:</p><p>years = 5: Initializes a variable named years with the value 5.</p><p>if True or False:: This is an if statement with a condition. The condition is True or False, which will always be True because the logical OR (or) operator returns True if at least one of the operands is True. In this case, True is always True, so the condition is satisfied.</p><p>years = years + 2: Inside the if block, there's an assignment statement that adds 2 to the current value of the years variable. Since the condition is always True, this line of code will always be executed.</p><p>print(years): Finally, this line prints the current value of the years variable.</p><p>As a result, the code will always enter the if block, increment the value of years by 2 (from 5 to 7), and then print the final value of years, which is 7.</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-3996256712880652692024-03-09T22:27:00.000-08:002024-03-09T22:27:54.559-08:00try and except in Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC2z-verFGh_Wf6bAt2S6e6eLs7U_Zg7e7y_BI2anWvl0k3qioXrl3hlMjKBFmbDOnLGz0m27iZS2f6S0VPITD3eLZQ1dJrq8yavRL5kvgXROS3AomxHzNY-PL5PdhvfqRqykRdJV3j9Sim2A-MvysWiQHb5vaOE6cLSHBwLz45iT-6PPiH7pu6hAbrhE/s1080/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC2z-verFGh_Wf6bAt2S6e6eLs7U_Zg7e7y_BI2anWvl0k3qioXrl3hlMjKBFmbDOnLGz0m27iZS2f6S0VPITD3eLZQ1dJrq8yavRL5kvgXROS3AomxHzNY-PL5PdhvfqRqykRdJV3j9Sim2A-MvysWiQHb5vaOE6cLSHBwLz45iT-6PPiH7pu6hAbrhE/s16000/1.png" /></a></div><br /><p></p><p>Example 1: Handling a Specific Exception</p><p>try:</p><p> # Code that might raise an exception</p><p> num = int(input("Enter a number: "))</p><p> result = 10 / num</p><p> print("Result:", result)</p><p></p><p>except ZeroDivisionError:</p><p> # Handle the specific exception (division by zero)</p><p> print("Error: Cannot divide by zero.")</p><p></p><p>except ValueError:</p><p> # Handle the specific exception (invalid input for conversion to int)</p><p> print("Error: Please enter a valid number.")</p><p> </p><p>#clcoding.com</p><p>Enter a number: 5</p><p>Result: 2.0</p><p>Example 2: Handling Multiple Exceptions</p><p>try:</p><p> file_name = input("Enter the name of a file: ")</p><p> </p><p> # Open and read the contents of the file</p><p> with open(file_name, 'r') as file:</p><p> contents = file.read()</p><p> print("File contents:", contents)</p><p></p><p>except FileNotFoundError:</p><p> # Handle the specific exception (file not found)</p><p> print("Error: File not found.")</p><p></p><p>except PermissionError:</p><p> # Handle the specific exception (permission error)</p><p> print("Error: Permission denied to access the file.")</p><p> </p><p>except Exception as e:</p><p> # Handle any other exceptions not explicitly caught</p><p> print(f"An unexpected error occurred: {e}")</p><p></p><p> #clcoding.com</p><p>Enter the name of a file: clcoding</p><p>Error: File not found.</p><p>Example 3: Using a Generic Exception</p><p>try:</p><p> # Code that might raise an exception</p><p> x = int(input("Enter a number: "))</p><p> y = 10 / x</p><p> print("Result:", y)</p><p></p><p>except Exception as e:</p><p> # Catch any type of exception</p><p> print(f"An error occurred: {e}")</p><p> </p><p> #clcoding.com</p><p>Enter a number: 5</p><p>Result: 2.0</p><p></p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-83210165439357526862024-03-09T08:36:00.000-08:002024-03-09T08:36:29.396-08:00Python Coding challenge - Day 145 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqlilu8M1GWSwPC63RkjvjWom-oEW_5RXYXyv__Xm9-vyM95dd7WTPeIzIAZ4szEQin3O7Fh9lC96Xbb7nPo1mz9M8_lEBpnsILsFo5IKTUcEdua-Z3mGhAtOoOTfx4A92o-_l4b0-ZFS0SYyLlYVBEsxUAwIZbwYGJtw1MgaNOq5l57lMsTzdcriSRtM/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-09T220407.912.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqlilu8M1GWSwPC63RkjvjWom-oEW_5RXYXyv__Xm9-vyM95dd7WTPeIzIAZ4szEQin3O7Fh9lC96Xbb7nPo1mz9M8_lEBpnsILsFo5IKTUcEdua-Z3mGhAtOoOTfx4A92o-_l4b0-ZFS0SYyLlYVBEsxUAwIZbwYGJtw1MgaNOq5l57lMsTzdcriSRtM/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-09T220407.912.png" /></a></div><br /><p></p><p>Let's evaluate the provided Python code:</p><p>a = 20 or 40</p><p>if 30 <= a <= 50:</p><p> print('Hello')</p><p>else:</p><p> print('Hi')</p><p>Here's a step-by-step breakdown:</p><p>Assignment of a:</p><p>a = 20 or 40: In Python, the or operator returns the first true operand or the last operand if none are true. In this case, 20 is considered true, so a is assigned the value 20.</p><p>Condition Check:</p><p>if 30 <= a <= 50:: Checks whether the value of a falls within the range from 30 to 50 (inclusive).</p><p>Print Statement Execution:</p><p>Since a is assigned the value 20, which is outside the range 30 to 50, the condition is not met.</p><p>Therefore, the else block is executed, and the output will be Hi.</p><p>Let's run through the logic:</p><p>Is 30 <= 20 <= 50? No.</p><p>So, the else block is executed, and 'Hi' is printed.</p><p>The output of this code will be:</p><p>Hi</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-30478327115858179302024-03-08T22:17:00.000-08:002024-03-08T22:17:35.389-08:00Lambda Functions in Python<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiunNl4jMxjoEiDxR0A-6zqekF2ko0vShGzipIawTokubC2QoyOD1AA33YC1seLofGBhbdSEdvofn0pXiE_zf3o_IQMMNHantHLjiTX6EhvrefzaC7S14eN9yMoP7GqA8VoEgusFN1_kOVBuqbgmFFHNPXVmrt9n5WXHGsWRx2km6ndnB4PlqKWsdDNwV8/s1080/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiunNl4jMxjoEiDxR0A-6zqekF2ko0vShGzipIawTokubC2QoyOD1AA33YC1seLofGBhbdSEdvofn0pXiE_zf3o_IQMMNHantHLjiTX6EhvrefzaC7S14eN9yMoP7GqA8VoEgusFN1_kOVBuqbgmFFHNPXVmrt9n5WXHGsWRx2km6ndnB4PlqKWsdDNwV8/s16000/1.png" /></a></div><br /><p></p><p>Example 1: Basic Syntax</p><p># Regular function</p><p>def add(x, y):</p><p> return x + y</p><p></p><p># Equivalent lambda function</p><p>lambda_add = lambda x, y: x + y</p><p></p><p># Using both functions</p><p>result_regular = add(3, 5)</p><p>result_lambda = lambda_add(3, 5)</p><p></p><p>print("Result (Regular Function):", result_regular)</p><p>print("Result (Lambda Function):", result_lambda)</p><p></p><p>#clcoding.com</p><p>Result (Regular Function): 8</p><p>Result (Lambda Function): 8</p><p>Example 2: Sorting with Lambda</p><p># List of tuples</p><p>students = [("Alice", 25), ("Bob", 30), ("Charlie", 22)]</p><p></p><p># Sort by age using a lambda function</p><p>sorted_students = sorted(students, key=lambda student: student[1])</p><p></p><p>print("Sorted Students by Age:", sorted_students)</p><p></p><p>#clcoding.com</p><p>Sorted Students by Age: [('Charlie', 22), ('Alice', 25), ('Bob', 30)]</p><p>Example 3: Filtering with Lambda</p><p># List of numbers</p><p>numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]</p><p></p><p># Filter even numbers using a lambda function</p><p>even_numbers = list(filter(lambda x: x % 2 == 0, numbers))</p><p></p><p>print("Even Numbers:", even_numbers)</p><p></p><p>#clcoding.com</p><p>Even Numbers: [2, 4, 6, 8]</p><p>Example 4: Mapping with Lambda</p><p># List of numbers</p><p>numbers = [1, 2, 3, 4, 5]</p><p></p><p># Square each number using a lambda function</p><p>squared_numbers = list(map(lambda x: x**2, numbers))</p><p></p><p>print("Squared Numbers:", squared_numbers)</p><p></p><p>#clcoding.com</p><p>Squared Numbers: [1, 4, 9, 16, 25]</p><p>Example 5: Using Lambda with max function</p><p># List of numbers</p><p>numbers = [10, 5, 8, 20, 15]</p><p></p><p># Find the maximum number using a lambda function</p><p>max_number = max(numbers, key=lambda x: -x) # Use negation for finding the minimum</p><p></p><p>print("Maximum Number:", max_number)</p><p></p><p>#clcoding.com</p><p>Maximum Number: 5</p><p>Example 6: Using Lambda with sorted and Multiple Criteria</p><p># List of dictionaries representing people with names and ages</p><p>people = [{"name": "Alice", "age": 25}, {"name": "Bob", "age": 30}, {"name": "Charlie", "age": 22}]</p><p></p><p># Sort by age and then by name using a lambda function</p><p>sorted_people = sorted(people, key=lambda person: (person["age"], person["name"]))</p><p></p><p>print("Sorted People:", sorted_people)</p><p></p><p>#clcoding.com</p><p>Sorted People: [{'name': 'Charlie', 'age': 22}, {'name': 'Alice', 'age': 25}, {'name': 'Bob', 'age': 30}]</p><p>Example 7: Using Lambda with reduce from functools</p><p>from functools import reduce</p><p></p><p># List of numbers</p><p>numbers = [1, 2, 3, 4, 5]</p><p></p><p># Calculate the product of all numbers using a lambda function and reduce</p><p>product = reduce(lambda x, y: x * y, numbers)</p><p></p><p>print("Product of Numbers:", product)</p><p></p><p>#clcoding.com</p><p>Product of Numbers: 120</p><p>Example 8: Using Lambda with Conditional Expressions</p><p># List of numbers</p><p>numbers = [10, 5, 8, 20, 15]</p><p></p><p># Use a lambda function with a conditional expression to filter and square even numbers</p><p>filtered_and_squared = list(map(lambda x: x**2 if x % 2 == 0 else x, numbers))</p><p></p><p>print("Filtered and Squared Numbers:", filtered_and_squared)</p><p></p><p>#clcoding.com</p><p>Filtered and Squared Numbers: [100, 5, 64, 400, 15]</p><p>Example 9: Using Lambda with key in max and min to Find Extremes</p><p># List of tuples representing products with names and prices</p><p>products = [("Laptop", 1200), ("Phone", 800), ("Tablet", 500), ("Smartwatch", 200)]</p><p></p><p># Find the most and least expensive products using lambda functions</p><p>most_expensive = max(products, key=lambda item: item[1])</p><p>least_expensive = min(products, key=lambda item: item[1])</p><p></p><p>print("Most Expensive Product:", most_expensive)</p><p>print("Least Expensive Product:", least_expensive)</p><p></p><p>#clcoding.com</p><p>Most Expensive Product: ('Laptop', 1200)</p><p>Least Expensive Product: ('Smartwatch', 200)</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-50689819048184536362024-03-08T06:07:00.000-08:002024-03-08T06:07:35.063-08:00Python Coding challenge - Day 144 | What is the output of the following Python Code?<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiMlQm7HPPageWB8jbc1olVyWRCPD90Z9P-Jt1WXFt99DF_YIUFZ6LDpAYCdcLt8yLD8qIp2_qlxzZSWQ6XiPX_4i6Ea1sCCxp9pic_aM0qTSUsHKglCJM3EwRKROcaS71jD-lZIJkZsW8GYEmdbJp3yJW7P0yGQ59VGCUjKwvIo4ml0YOV04Btt0sobA/s1080/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-08T192910.547.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1080" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiMlQm7HPPageWB8jbc1olVyWRCPD90Z9P-Jt1WXFt99DF_YIUFZ6LDpAYCdcLt8yLD8qIp2_qlxzZSWQ6XiPX_4i6Ea1sCCxp9pic_aM0qTSUsHKglCJM3EwRKROcaS71jD-lZIJkZsW8GYEmdbJp3yJW7P0yGQ59VGCUjKwvIo4ml0YOV04Btt0sobA/s16000/What%20is%20the%20output%20of%20the%20following%20Python%20code%20-%202024-03-08T192910.547.png" /></a></div><p></p><p>The code print(()*3) in Python will print an empty tuple three times.</p><p>Let's break down the code:</p><p>print(): This is a built-in function in Python used to output messages to the console.</p><p>(): This represents an empty tuple. A tuple is an ordered collection of items similar to a list, but unlike lists, tuples are immutable, meaning their elements cannot be changed after creation.</p><p>*3: This is the unpacking operator. In this context, it unpacks the empty tuple three times.</p><p>Since an empty tuple by itself doesn't contain any elements to print, it essentially prints nothing three times. So the output of this code will be an empty line repeated three times.</p>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-78648851919621976752024-03-08T01:39:00.000-08:002024-03-08T01:39:53.625-08:00Fractal Data Science Professional Certificate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://imp.i384100.net/Vm9Dqa" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="796" data-original-width="1551" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzw1Mwa43fVapH3CmUZZJTBjJ7o2Dys6RLGbYwS3McTkzvvc9iEdibg891oiOjv4exPAAGAN3leccIRPt-xaEpNMhzC9xjwwS7Azb2e2YiYAnJaASi-ibXwiR0F99CF0STVD9PN6mqQhbd7KZnhRNerNpRPgHamGMSa0i2880UILWz3FdVz2JH_2LZ4zs/s16000/Fractal%20Data%20Science%20Professional%20Certificate.PNG" /></a></div><br /><p></p><h2 style="text-align: left;">What you'll learn</h2><p> Apply structured problem-solving techniques to dissect and address complex data-related challenges encountered in real-world scenarios. </p><p>Utilize SQL proficiency to retrieve, manipulate data and employ data visualization skills using Power BI to communicate insights.</p><p>Apply Python expertise for data manipulation, analysis and implement machine learning algorithms to create predictive models for applications.</p><p>Create compelling data stories to influence your audience and master the art of critically analyzing data while making decisions and recommendations.</p><h2 style="text-align: left;">Join Free: <a href="https://imp.i384100.net/Vm9Dqa" target="_blank">Fractal Data Science Professional Certificate</a></h2><div><h2 style="text-align: left;">Professional Certificate - 8 course series</h2><div>Data science is projected to create 11.5 1 million global job openings by 2026 and offers many of the remote 2 job opportunities in the industry.</div><div><br /></div><div>Prepare for a new career in this high-demand field with a Professional Certificate from Fractal Analytics. Whether you're a recent graduate seeking a rewarding career shift or a professional aiming to upskill, this program will equip you with the essential skills demanded by the industry.</div><div><br /></div><div>This curriculum is designed with a problem-solving approach at the center to equip and enable you with the skills, required to solve data science problems, instead of just focusing on the tools and applications.</div><div><br /></div><div>Through hands-on courses you'll master Python programming, harness the power of machine learning, cultivate expertise in data manipulation, and build understanding of cognitive factors affecting decisions. You will also learn the direct application of tools like SQL, PowerBI, and Python to real-world scenarios.</div><div><br /></div><div>Upon completion, you will earn a Professional Certificate, which will help to make your profile standout in your career journey.</div><div><br /></div><div>Fractal Data Science Professional Certificate is one of the preferred qualifications for entry-level data science jobs at Fractal. Complete this certificate to make your profile standout from other candidates while applying for job openings at Fractal.</div></div><div><br /></div><div><div><b>Applied Learning Project</b></div><div><br /></div><div>Learners will be able to apply structured problem-solving techniques to dissect and address complex data-related challenges encountered in real-world scenarios and utilize SQL proficiency to retrieve and manipulate data and employ data visualization skills using Power BI to communicate insights. Becoming experts at Python programming to manipulate and analyze data. Learners will implement machine learning algorithms to create predictive models for diverse applications. And create compelling data stories to influence and inform your audience and master the art of critically analyzing data while making decisions and recommendations.</div></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-6940711710363810872024-03-08T01:35:00.000-08:002024-03-08T01:35:51.398-08:00CertNexus Certified Data Science Practitioner Professional Certificate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://imp.i384100.net/QyLdox" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="779" data-original-width="1501" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4_GpW5OwYHPjCimQRqYjq6hFwZCjSKRcDRfOEfyAuKJnn2uCZ29i7T7PkDQ3pXMGtmaMnjDVfqkkUIkFoCM0xN42QOAllrvC_q_ED8kKiVnz7sIdKTxhj0j9-tEgIM3Dnv76SjeFUEcXSHL9vjV-d_YDICjdr3fQtEss7i2ji64zkj2va_sUCNhkDov8/s16000/CertNexus%20Certified%20Data%20Science%20Practitioner%20Professional%20Certificate.PNG" /></a></div><br /><p></p><h3 style="text-align: left;">Advance your career with in-demand skills</h3><p>Receive professional-level training from CertNexus</p><p>Demonstrate your technical proficiency</p><p>Earn an employer-recognized certificate from CertNexus</p><p>Prepare for an industry certification exam</p><h2 style="text-align: left;">Join Free: <a href="https://imp.i384100.net/QyLdox" target="_blank">CertNexus Certified Data Science Practitioner Professional Certificate</a></h2><div><h2 style="text-align: left;">Professional Certificate - 5 course series</h2><div>The field of Data Science has topped the Linked In Emerging Jobs list for the last 3 years with a projected growth of 28% annually and the World Economic Forum lists Data Analytics and Scientists as the top emerging job for 2022. </div><div><br /></div><div>Data can reveal insights and inform business—by guiding decisions and influencing day-to-day operations. This specialization will teach learners how to analyze, understand, manipulate, and present data within an effective and repeatable process framework and will enable you to bring value to the business by putting data science concepts into practice. </div><div><br /></div><div>This course is designed for business professionals that want to learn how to more effectively extract insights from their work and leverage that insight in addressing business issues, thereby bringing greater value to the business. The typical student in this course will have several years of experience with computing technology, including some aptitude in computer programming.</div><div><br /></div><div>Certified Data Science Practitioner (CDSP) will prepare learners for the CertNexus CDSP certification exam. </div><div><br /></div><div>To complete your journey to the CDSP Certification</div><div><br /></div><div>Complete the Coursera Certified Data Science Practitioner Professional Certificate.</div><div><br /></div><div>Review the CDSP Exam Blueprint</div><div>.</div><div><br /></div><div>Purchase your CDSP Exam Voucher</div><div><br /></div><div>Register for your CDSP Exam.</div><div><br /></div><div><b>Applied Learning Project</b></div><div><br /></div><div>At the conclusion of each course, learners will have the opportunity to complete a project which can be added to their portfolio of work. Projects include: </div><div><br /></div><div>Address a Business Issue with Data Science </div><div><br /></div><div>Extract, Transform, and Load Data</div><div><br /></div><div><b>Data Analysis</b></div><div><br /></div><div>Training a Machine Learning Model</div><div><br /></div><div>Presenting a Data Science Project</div></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-79112670088420875402024-03-08T01:29:00.000-08:002024-03-08T01:29:11.558-08:00IBM Data Engineering Professional Certificate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://imp.i384100.net/PynRaR" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="808" data-original-width="1554" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9ZWHdFA6voDkxJHMVwY5kXfU3adm29vkSIZ9iPZI3rjIrENrg1WLco4hDZcwv9O78CvHOniGhxX3VvRCyl4N3oZwzJZsuu9UNH4UEDsUrFy8OqNRAy9cY1DFGNVkvSr02TC7PlAfVhs0ZHDNGqgIUI3F8x9QHv9UR8vzX6Dnl-tQL_aO0gClBL2LV9eg/s16000/IBM%20Data%20Engineering%20Professional%20Certificate.PNG" /></a></div><br /><p></p><h2 style="text-align: left;">What you'll learn</h2><p>Master the most up-to-date practical skills and knowledge data engineers use in their daily roles</p><p>Learn to create, design, & manage relational databases & apply database administration (DBA) concepts to RDBMSs such as MySQL, PostgreSQL, & IBM Db2 </p><p>Develop working knowledge of NoSQL & Big Data using MongoDB, Cassandra, Cloudant, Hadoop, Apache Spark, Spark SQL, Spark ML, and Spark Streaming </p><p>Implement ETL & Data Pipelines with Bash, Airflow & Kafka; architect, populate, deploy Data Warehouses; create BI reports & interactive dashboards </p><h2 style="text-align: left;">Join Free: <a href="https://imp.i384100.net/PynRaR" target="_blank">IBM Data Engineering Professional Certificate</a></h2><div><h2 style="text-align: left;">Professional Certificate - 13 course series</h2><div>Prepare for a career in the high-growth field of data engineering. In this program, you’ll learn in-demand skills like Python, SQL, and Databases to get job-ready in less than 5 months.</div><div><br /></div><div>Data engineering is building systems to gather data, process and organize raw data into usable information, and manage data. The work data engineers do provides the foundational information that data scientists and business intelligence (BI) analysts use to make recommendations and decisions.</div><div><br /></div><div>This program will teach you the foundational data engineering skills employers are seeking for entry level data engineering roles, including Python, one of the most widely used programming languages. You’ll also master SQL, RDBMS, ETL, Data Warehousing, NoSQL, Big Data, and Spark with hands-on labs and projects.</div><div><br /></div><div>You’ll learn to use Python programming language and Linux/UNIX shell scripts to extract, transform and load (ETL) data. You’ll also work with Relational Databases (RDBMS) and query data using SQL statements and use NoSQL databases as well as unstructured data. </div><div><br /></div><div>When you complete the full program, you’ll have a portfolio of projects and a Professional Certificate from IBM to showcase your expertise. You’ll also earn an IBM Digital badge and will gain access to career resources to help you in your job search, including mock interviews and resume support. </div><div><br /></div><div>This program is ACE® recommended—when you complete, you can earn up to 12 college credits.</div><div><br /></div><div><b>Applied Learning Project</b></div><div><br /></div><div>Throughout this Professional Certificate, you will complete hands-on labs and projects to help you gain practical experience with Python, SQL, relational databases, NoSQL databases, Apache Spark, building data pipelines, managing databases, and working with data warehouses.</div><div><br /></div><div>Design a relational database to help a coffee franchise improve operations.</div><div><br /></div><div>Use SQL to query census, crime, and school demographic data sets.</div><div><br /></div><div>Write a Bash shell script on Linux that backups changed files.</div><div><br /></div><div>Set up, test, and optimize a data platform that contains MySQL, PostgreSQL, and IBM Db2 databases.</div><div><br /></div><div>Analyze road traffic data to perform ETL and create a pipeline using Airflow and Kafka.</div><div><br /></div><div>Design and implement a data warehouse for a solid-waste management company.</div><div><br /></div><div>Move, query, and analyze data in MongoDB, Cassandra, and Cloudant NoSQL databases.</div><div><br /></div><div>Train a machine learning model by creating an Apache Spark application.</div><div><br /></div><div>This program is FIBAA recommended—when you complete, you can earn up to 8 ECTS credits.</div></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-19318765364203192512024-03-08T01:24:00.000-08:002024-03-08T01:24:12.350-08:00Preparing for Google Cloud Certification: Cloud Data Engineer Professional Certificate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://imp.i384100.net/Or0djr" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="848" data-original-width="1566" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Bzs6LMB2mby1uDkROBkPx2ai4SPlKLD84rFLYbZGNEPzG6HFos30UmDRRYolOdXL9hjG164P2P5B5hgWJ7PpeV1IBmIAooFSGwykr5AXMXtR7DxJW4RsUMhKIzEdHVhvBeciwX1sha5g3kBw5GDvH76nuSNwTFa1prgGVekpLUtH9KtYyvP2Y3T7uFc/s16000/Preparing%20for%20Google%20Cloud%20Certification%20Cloud%20Data%20Engineer%20Professional%20Certificate.PNG" /></a></div><br /><p></p><h2 style="text-align: left;">What you'll learn</h2><p>Identify the purpose and value of the key Big Data and Machine Learning products in Google Cloud.</p><p>Employ BigQuery to carry out interactive data analysis.</p><p>Use Cloud SQL and Dataproc to migrate existing MySQL and Hadoop/Pig/Spark/Hive workloads to Google Cloud.</p><p>Choose between different data processing products on Google Cloud.</p><h2 style="text-align: left;">Join Free: <a href="https://imp.i384100.net/Or0djr" target="_blank">Preparing for Google Cloud Certification: Cloud Data Engineer Professional Certificate</a> </h2><div><h2 style="text-align: left;">Professional Certificate - 6 course series</h2><div>Google Cloud Professional Data Engineer certification was ranked #1 </div><div>on Global Knowledge's list of 15 top-paying certifications in 2021</div><div>! Enroll now to prepare!</div><div><br /></div><div>---</div><div><br /></div><div>87% of Google Cloud certified users feel more confident in their cloud skills. This program provides the skills you need to advance your career and provides training to support your preparation for the industry-recognized</div><div> Google Cloud Professional Data Engineer</div><div> certification.</div><div><br /></div><div><b>Here's what you have to do</b></div><div><br /></div><div>1) Complete the Coursera Data Engineering Professional Certificate</div><div><br /></div><div>2) Review other recommended resources for the Google Cloud Professional Data Engineer certification</div><div> exam</div><div><br /></div><div>3) Review the Professional Data Engineer exam guide</div><div><br /></div><div>4) Complete Professional Data Engineer sample questions</div><div><br /></div><div>5)Register for the Google Cloud certification exam (remotely or at a test center)</div><div><br /></div><div><b>Applied Learning Project</b></div><div><br /></div><div>This professional certificate incorporates hands-on labs using Qwiklabs platform.These hands on components will let you apply the skills you learn. Projects incorporate Google Cloud Platform products used within Qwiklabs. You will gain practical hands-on experience with the concepts explained throughout the modules.</div><div><br /></div><div><b>Applied Learning Project</b></div><div><br /></div><div> This Professional Certificate incorporates hands-on labs using our Qwiklabs platform.</div><div><br /></div><div>These hands on components will let you apply the skills you learn in the video lectures. Projects will incorporate topics such as Google BigQuery, which are used and configured within Qwiklabs. You can expect to gain practical hands-on experience with the concepts explained throughout the modules.</div></div><div><br /></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-29059428336615172372024-03-08T01:17:00.000-08:002024-03-08T01:17:38.868-08:00Tableau Business Intelligence Analyst Professional Certificate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://imp.i384100.net/DKGd4a" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="781" data-original-width="1581" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1CTyURepZWxkKrncFzHo1ODEG9w0R0M67g3DSwgGbZyQNF9k51mFbVy9wqQwMgHQQ7yuMShy11R2ISwvIc6Jgpw4Xjv1vaE_X2YiOlNXC3fwHrlDhMCowZLCJfzFHieRJTBVq4G49ES4pJ_IPfXTdrE14EmoaPjwZUlRB8sD2emgIdSa8_nrGj58RKPU/s16000/Tableau%20Business%20Intelligence%20Analyst%20Professional%20Certificate.PNG" /></a></div><br /><p></p><h2 style="text-align: left;">What you'll learn</h2><p>Gain the essential skills necessary to excel in an entry-level Business Intelligence Analytics role.</p><p>Learn to use Tableau Public to manipulate and prepare data for analysis.</p><p>Craft and dissect data visualizations that reveal patterns and drive actionable insights.</p><p>Construct captivating narratives through data, enabling stakeholders to explore insights effectively.</p><h2 style="text-align: left;">Join Free: <a href="https://imp.i384100.net/DKGd4a" target="_blank">Tableau Business Intelligence Analyst Professional Certificate</a></h2><div><h2 style="text-align: left;">Professional Certificate - 8 course series</h2><div>Whether you are just starting out or looking for a career change, the Tableau Business Intelligence Analytics Professional Certificate will prepare you for entry-level roles that require fundamental Tableau skills, such as business intelligence analyst roles. If you are detail-oriented and have an interest in looking for trends in data, this program is for you. Through hands-on, real-world scenarios, you learn how to use the Tableau platform to evaluate data to generate and present actionable business insights. Upon completion, you will be prepared to take the </div><div>Tableau Desktop Specialist Exam</div><div>. With this certification, you will be qualified to apply for a position in the business intelligence analyst field. </div><div><br /></div><div><b>In this program, you’ll: </b></div><div><br /></div><div> Craft problem statements, business requirement documents, and visual models.</div><div><br /></div><div> Connect with various data sources and preprocess data in Tableau for enhanced quality and analysis.</div><div><br /></div><div> Learn to utilize the benefits of Tableau’s analytics features for efficient reporting.</div><div><br /></div><div>Learn to create advanced and spatial analytics data visualizations by integrating motion and multi-layer elements to effectively communicate insights to stakeholders.</div><div><br /></div><div>Employ data storytelling principles and design techniques to craft compelling presentations that empower you to extract meaningful insights.</div><div><br /></div><div>This program was developed by Tableau experts, designed to prepare you for a career in Business Intelligence Analytics and help you learn the most relevant skills.</div><div><br /></div><div><b>Applied Learning Project</b></div><div><br /></div><div> Throughout the program, you’ll engage in applied learning through hands-on activities to help level up your knowledge. Each course contains ungraded quizzes throughout the content, a graded quiz at the end of each module, and a variety of hands-on projects. The program activities will give you the skills to : </div><div><br /></div><div>Preprocess, manage, and manipulate data for analysis using Tableau. </div><div><br /></div><div>Create and customize Visualizations in Tableau. </div><div><br /></div><div>Learn best practices for creating presentations to communicate data analysis insights to stakeholders. </div></div>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0tag:blogger.com,1999:blog-6717320762938372130.post-15744692763497824712024-03-07T00:17:00.000-08:002024-03-07T00:17:16.213-08:00Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://amzn.to/3v2fn3A" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="1500" data-original-width="1216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTX8DA9J0IxXRWvI2WL-gwj8EB0JqOOmQXGSMVDr8zXAvVJraly4UFmpTZoUBH4Pv9LzKffkyUh4oFT1kr0U9aA8A3KZ0YEHl8rxXbGnNHKU1XJRcIeJGnMRUihmwXrVcdbiLdsIQQUEHGcnjlldm9YoiDv4Yf1sbkMyhfXHPSYcq9FeBJj26W2TNRkk/s16000/Interpretable%20Machine%20Learning%20with%20Python%20-%20Second%20Edition%20Build%20explainable,%20fair,%20and%20robust%20high-performance%20models%20with%20hands-on,%20real-world%20examples.jpg" /></a></div><br /><p></p><p><b>A deep dive into the key aspects and challenges of machine learning interpretability using a comprehensive toolkit, including SHAP, feature importance, and causal inference, to build fairer, safer, and more reliable models.</b></p><p><b>Purchase of the print or Kindle book includes a free eBook in PDF format.</b></p><h2 style="text-align: left;">Key Features</h2><p>Interpret real-world data, including cardiovascular disease data and the COMPAS recidivism scores</p><p>Build your interpretability toolkit with global, local, model-agnostic, and model-specific methods</p><p>Analyze and extract insights from complex models from CNNs to BERT to time series models</p><h2 style="text-align: left;">Book Description</h2><p>Interpretable Machine Learning with Python, Second Edition, brings to light the key concepts of interpreting machine learning models by analyzing real-world data, providing you with a wide range of skills and tools to decipher the results of even the most complex models.</p><p>Build your interpretability toolkit with several use cases, from flight delay prediction to waste classification to COMPAS risk assessment scores. This book is full of useful techniques, introducing them to the right use case. Learn traditional methods, such as feature importance and partial dependence plots to integrated gradients for NLP interpretations and gradient-based attribution methods, such as saliency maps.</p><p>In addition to the step-by-step code, you'll get hands-on with tuning models and training data for interpretability by reducing complexity, mitigating bias, placing guardrails, and enhancing reliability.</p><p>By the end of the book, you'll be confident in tackling interpretability challenges with black-box models using tabular, language, image, and time series data.</p><h2 style="text-align: left;">What you will learn</h2><p>Progress from basic to advanced techniques, such as causal inference and quantifying uncertainty</p><p>Build your skillset from analyzing linear and logistic models to complex ones, such as CatBoost, CNNs, and NLP transformers</p><p>Use monotonic and interaction constraints to make fairer and safer models</p><p>Understand how to mitigate the influence of bias in datasets</p><p>Leverage sensitivity analysis factor prioritization and factor fixing for any model</p><p>Discover how to make models more reliable with adversarial robustness</p><h2 style="text-align: left;">Who this book is for</h2><p>This book is for data scientists, machine learning developers, machine learning engineers, MLOps engineers, and data stewards who have an increasingly critical responsibility to explain how the artificial intelligence systems they develop work, their impact on decision making, and how they identify and manage bias. It's also a useful resource for self-taught ML enthusiasts and beginners who want to go deeper into the subject matter, though a good grasp of the Python programming language is needed to implement the examples.</p><h2 style="text-align: left;">Table of Contents</h2><p>Interpretation, Interpretability and Explainability; and why does it all matter?</p><p>Key Concepts of Interpretability</p><p>Interpretation Challenges</p><p>Global Model-agnostic Interpretation Methods</p><p>Local Model-agnostic Interpretation Methods</p><p>Anchors and Counterfactual Explanations</p><p>Visualizing Convolutional Neural Networks</p><p>Interpreting NLP Transformers</p><p>Interpretation Methods for Multivariate Forecasting and Sensitivity Analysis</p><p>Feature Selection and Engineering for Interpretability</p><p>Bias Mitigation and Causal Inference Methods</p><p>Monotonic Constraints and Model Tuning for Interpretability</p><p>Adversarial Robustness</p><p>What's Next for Machine Learning Interpretability?</p><h2 style="text-align: left;">Hard Copy: <a href="https://amzn.to/3Tnz6nJ" target="_blank">Interpretable Machine Learning with Python - Second Edition: Build explainable, fair, and robust high-performance models with hands-on, real-world examples</a></h2>Python Codinghttp://www.blogger.com/profile/12358561304849907392noreply@blogger.com0