teleren/devto huggingface dataset:
Python Programming Bootcamp #6 - if, else, elif
Tags: python, beginners, tutorial
Published: 2022-11-29 15:36:00

---
title: Python Programming Bootcamp #6 - if, else, elif
published: true
description: Why is it useful to know some of the differences between Python 2 and Python 3
tags: python, beginners, tutorial
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2022-11-29 15:36 +0000
canonical_url: https://code-maven.com/programming-bootcamp-for-scientists-6
series: bootcamp
---

{% youtube gTpTxjk1KIw %}


00:00 "[Second steps](https://code-maven.com/slides/python/second-steps)" starting at Input/Output till the exercises.
00:00 Input - Output I/O
05:23 print in Python 2
08:12 print in Python 3
13:00 from __future__ import print_function
14:57 [Exception: SyntaxError: Missing parentheses in call](https://code-maven.com/slides/python/syntax-error-missing-parentheses-in-call)
15:50 Prompting for user input in Python 2 (raw_input)
19:20 Prompting for user input in Python 3 (input)
26:01 Prompting in both Python 2 and Python 3.
28:45 Add numbers entered by the user. [oups](https://code-maven.com/slides/python/python-add-strings)
32:30 How can I check if a string can be converted to a number?
37:26 Nóra pointing out the error in the previous example. Oups.
38:23 Converting string to int
41:49 Conditionals: [if](https://code-maven.com/slides/python/python-conditionals-if), else, elif
53:20 [Ternary operator](https://code-maven.com/slides/python/ternary-operator) (Conditional Operator)
56:00 Case and switch in Python.
56:30 Exercises: Rectangle, Circle, Calculator
57:40 Learning Python the Hard way.
The 2023 open source maintainer survey aims to share the state of open source today
Tags: opensource, news, devops, webdev
Published: 2022-11-29 15:22:24



![Tidelift 2023 Maintainers Survey Image](https://community.tidelift.com/remoteimages/uploads/articles/zxirriznig7ixk933bjf.png)

**TL;DR: our new open source maintainer survey is LIVE and we'd love your input!** 
## [Take the survey!](https://tidelift.az1.qualtrics.com/jfe/form/SV_9MiyvHf8sVyaf5k?Q_CHL=social&Q_SocialSource=community)


---

**At Tidelift, we’re passionate about making open source better — for everyone.** We imagine a world where both organizations can maximize the health and security of the open source used in their applications and open source creators can thrive with full recognition and compensation for the value they create.

We’re constantly innovating in the way we holistically support the open source maintainer ecosystem. We conducted the first maintainer-only survey in 2021 to provide insights about the lived experiences of open source maintainers. **Here are the top 3 most notable findings from the past survey:**

- Almost half of maintainers don’t get paid anything to work on their projects.

- Maintainers spend less than ¼ of their project time writing code.

- More than half of maintainers have quit or considered quitting.

**We’re curious how things have changed since then.** Are more maintainers earning money? And if so, how much more? Are the same things still driving maintainers to keep maintaining? What holds maintainers back from doing their best work?
 

![2023 maintainers survey perks image](https://community.tidelift.com/remoteimages/uploads/articles/rkxsvcpc5tv3rapy6uo6.png)

Our newest survey **includes questions we’ve never asked before** that will help us capture the best picture of what it’s like to be an open source maintainer today. The results will help us amplify maintainer voices and get them the resources needed to be successful in maintaining a healthy open source project.


If you’re an open source maintainer, we invite you to share your thoughts and be a part of the conversation. If you are already working as a lifter for Tidelift (or apply to lift a project and are accepted as a new lifter), we'll send you a limited edition Tidelift backpack (learn more about how lifting a project works here). If you are an open source maintainer not working with Tidelift, we'd still like to hear from you! Fill out the survey and get our latest Pay the Maintainers t-shirt.  

*Your submissions to this survey are covered by the Tidelift privacy policy. If you are interested in the custom Tidelift backpack or Pay the Maintainers t-shirt, make sure to share your mailing address at the end of the survey.*




[Take the survey](https://tidelift.az1.qualtrics.com/jfe/form/SV_9MiyvHf8sVyaf5k?Q_CHL=social&Q_SocialSource=community)
New to NumPy?
Tags: python, programming, beginners
Published: 2022-11-29 15:22:22

In **python**, the library  which is used to create and manipulates matrices is **NumPy**. Basically, NumPy works with arrays. For instances array is an ordered series or arrangement of numbers/objects. NumPy stands for "**Numerical Python**".

Let's see how can we use Numpy to work with matrices.

First import NumPy module with running the following code.
```
import numpy as np
```


## 1. NumPy Arrays

Let us create a list.

```
my_list=[1,2,3]
```
Now call np.array to craete a NumPy array with the list.

```
arr=np.array(my_list)
```
And type arr to see the array.

```
arr
```
We can create this array by directly putting the values like:

```
arr=np.array([1,2,3])
```
The array we have created was an one dimensional array. We can create two dimensional array. Let's create a three by three array.

```
mt=[[1,2,3],[4,5,6],[7,8,9]]
np.array(mt)
```

Let's create a sequence starting at zero, step size or difference is 2, to 11

```
np.arange(0,11,2)
```
Here, we are creating a five by five dimensional array containing only zeros:

```
np.zeros((5,5))
```
We can also create matrics having only value 1, identity matrics etc (example are given in the notebook).

We can create array with values from a specific distribution such as standard normal distribution, uniform distribution, poisson distribution, binomial distribution, chi square distribution etc. For example we can create a two dimensional array with sample from uniform distribution(0 to 1).

```
np.random.rand(5,5)
```
We can find the maximum or minimum values is the array.

```
#array returning random integers
ranarr=np.random.randint(0,50,10)
ranarr.max()
```
While returning the maximum value of the array we can also find the location for the maximum value.

```
ranarr.argmax()
```



## 2.NumPy Indexing and Selection
Let us create a two dimensional array first.
```
arr=np.array([[5,10,15],[20,25,30],[35,40,45]])
arr
```
and we get
`array([[ 5, 10, 15],
       [20, 25, 30],
       [35, 40, 45]])`

If we want to get the value 10 we type

```
arr_2d[0][1]
```
In python, indexing starts from 0, so if we want to grab except the third row we type, because third row indexed as 2.

```
arr_2d[:2]
```



## 3. NumPy Operations
Let's do some arithmatic operations with numpy

```
ar=np.arange(1,11)
```
Addition:

```
ar+ar
```

Substraction: Substract array from a array and substract a scaler from array

```
ar-ar
ar-4
```
Multiplication:

```
ar*3
```



## 4. Universal Array Function
Universal Functions used to implement vectorization in NumPy which is more faster than iterating over elements. For example:
To find a array containing square root of each values in array we type

```
np.sqrt(ar)
```
Taking exponential of each values of the array:

```
np.exp(ar)
```
To find a product of arrays:

```
a= np.array([1, 2, 3, 4])
b = np.array([5, 6, 7, 8])

np.prod([a, b])

```

**You can practice more example at your own. The notebook link is given below. Go to the link and practice.**
Notebook Link: [https://www.kaggle.com/code/azizaafrin/python-numpy]

_Happy Learning!<3_
Web Server, HTML Elements and Live Server
Tags: hiteshchoudhary, ineuron, javascript, html
Published: 2022-11-29 15:19:29



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ae7383fqqys5szl2k85.jpg)
At the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via HTTP. When the request reaches the correct (hardware) web server, the (software) HTTP server accepts the request, finds the requested document, and sends it back to the browser, also through HTTP. (If the server doesn't find the requested document, it returns a 404 response instead.)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqrv1l7aqshzs9r8gfwc.jpg)

## HTML Elements

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/curc9cwgkiiyrf6axrzh.jpg)

The HTML element is everything from the start tag to the end tag:
<tagname>Content goes here...</tagname>

Examples of some HTML elements:

<h1>My First Heading</h1>
<p>My first paragraph.</p>

1. The <html> element is the root element and it defines the whole 
   HTML document.
2. It has a start tag <html> and an end tag </html>.
Then, inside the <html> element there is a <body> element:
Example :-

```
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
```

**`<h1>`–`<h6>`: The HTML Section Heading elements**

The `<h1>` to `<h6>` HTML elements represent six levels of section headings. `<h1>` is the highest section level and `<h6>` is the lowest.

**`<p>`: The Paragraph element**

The `<p>` HTML element represents a paragraph. Paragraphs are block-level elements, and notably will automatically close if another block-level element is parsed before the closing `</p>`

```
<p>
  This is the first paragraph of text. This is the first paragraph of text. This
  is the first paragraph of text. This is the first paragraph of text.
</p>
<p>
  This is the second paragraph. This is the second paragraph. This is the second
  paragraph. This is the second paragraph.
</p>
```
There are many HTML tags and they have their own attributes. If you want to know more about HTML tags then follow the [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML).

## Live Server
This is a little development server with live reload capability. Use it for hacking your HTML/JavaScript/CSS files, but not for deploying the final site.

There are two reasons for using this:

AJAX requests don’t work with the file:// protocol due to security restrictions, i.e. you need a server if your site fetches content through JavaScript.
Having the page reload automatically after changes to files can accelerate development.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/akq8bnpytaarz84u5br5.png)
Using External Web Components with Enhance
Tags: webdev, webcomponents, enhance
Published: 2022-11-29 14:59:51

---
title: Using External Web Components with Enhance
published: true
description: We love building web components with Enhance, but we realize that sometimes you may need to pull one off the shelf to include in your app. Follow along to see how to add a Vanilla JS web component to your Enhance app.
tags: webdev, webcomponents, enhance
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3ubtsqu3m43bwslimud.jpg
canonical_url: https://blog.begin.com/posts/2022-11-29-using-external-web-components-in-enhance
---

We love building web components with Enhance, but we realize that sometimes you may need to pull one off the shelf to include in your app. Follow along to see how to add a Vanilla JS web component to your Enhance app.

## VanillaWC

[VanillaWC](https://github.com/vanillawc) touts itself as:

> An open-source collection of Web Components implemented in vanilla JavaScript

I like that VanillaWC has no extra layers of abstraction between you and the web components. That means no dependencies and no additional build steps. It's like they are speaking our language. For this blog post, we will focus on [`wc-social-link`](https://github.com/vanillawc/wc-social-link), which enables you to add links to your GitHub, LinkedIn, Twitch, etc., to your page.

## Option 1: CDN

The easiest way to include the social link component on a page is to load it remotely from a CDN at runtime. For example:

```html
<script
  type="module"
  src="https://cdn.jsdelivr.net/gh/vanillawc/wc-social-link@1/index.js">
</script>
<wc-social-link
  network="github"
  handle="enhance-dev">
</wc-social-link>
```

That will add a GitHub icon to your page that links to the Enhance organization on GitHub.

Pretty easy, right? However, if you have added a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#:~:text=Content%20Security%20Policy%20(CSP)%20is,site%20defacement%2C%20to%20malware%20distribution.) to your app, and you should, then you may not want to add a remote domain to your allow list.

## Option 2: Bundling

Instead of trusting a 3rd party domain, we'll install `wc-social-link` locally by running:

```bash
npm install @vanillawc/wc-social-link
```

The `wc-social-link` project ships with a nice entry point for a bundle. We will bundle and expose `wc-social-link`'s main index file as `wc-social-link` by updating .arc with:

```arc
@bundles
wc-social-link './node_modules/@vanillawc/wc-social-link/src/wc-social-link.js'
```

Then you would load the web component from it's bundled path in your page:

```html
<script type="module" src="/_public/bundles/wc-social-link.mjs"></script>
<wc-social-link
  network="github"
  handle="enhance-dev">
</wc-social-link>
```

## Next Steps

Well, getting a web component written by a 3rd party into your Enhance app wasn't too difficult. The downside is this component only works with client-side rendering. Next week we'll show you how to refactor components like this so they can be server-side rendered and enhanced with client-side JS.
AWS NLP Newsletter Archive Directory
Tags: aws, nlp, machinelearning, ai
Published: 2022-11-29 14:58:49

---
title: AWS NLP Newsletter Archive Directory
published: True
description: 
tags: #aws #nlp #machinelearning #ai 
//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0q5tmv9n7sdd7cp8tdo.png
---

![AWS NLP Newsletter Archive Directory CoverPhoto](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0q5tmv9n7sdd7cp8tdo.png)


AWS NLP newsletter is curated by AWS NLP Community. We update all you need to know about Natural Language Processing on AWS of the month. Which includes service launch, customer case study, and community event info.

Here comes the archive:

**2022**
- [November 2022](https://dev.to/aws/aws-nlp-newsletter-november-2022-6mi)
- [October 2022](https://dev.to/aws/aws-nlp-newsletter-aws-nlp-summit-recap-5gel) - NLP Summit Recap
- [September 2022](https://dev.to/aws/nlpaws-newsletter-september-2022-4a7g)
- [August 2022](https://dev.to/aws/nlpaws-newsletter-082022-summer-edition-1n73)
- July 2022 - Summer break. No newsletter released.
- [June 2022](https://dev.to/aws/aws-nlp-newsletter-june-2022-2hml)
- [May 2022](https://dev.to/aws/nlpaws-newsletter-052022-5b1o)
- [April 2022](https://dev.to/aws/nlpaws-newsletter-042022-178d)
- [March 2022](https://dev.to/aws/aws-nlp-newsletter-february-2022-m6f)
- [February 2022](https://dev.to/aws/nlpaws-newsletter-022022-2onf)
- January 2022 - No newsletter released.


**2021**
- [December 2021](https://dev.to/aws/aws-nlp-newsletter-december-2021-18o3)
- [November 2021](https://dev.to/aws/aws-nlp-newsletter-november-2021-2d5m)
- [October 2021](https://dev.to/aws/aws-nlp-newsletter-2021-oct-2e3o)
- [September 2021](https://dev.to/aws/aws-nlp-newsletter-2021-sep-34o2)
- [August 2021](https://dev.to/aws/aws-nlp-newsletter-2021-aug-i40) - The First AWS NLP Newsletter

### Stay in touch with NLP on AWS
Our contact: aws-nlp@amazon.com
Email us about (1) your awesome project about NLP on AWS, (2) let us know which post in the newsletter helped your NLP journey, (3) other things that you want us to post on the newsletter. Talk to you soon.
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2022-11-29 14:48:50

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: icymi 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

## The Perfect Open-Sourcer Does Not Exist

Over the last four months, @batunpc has set various goals to become a better open-sourcer. Here's some food for thought as ya look to set your new year's resolutions.

{% embed https://dev.to/batunpc/the-perfect-open-sourcer-does-not-exist-26pb %}


## CSS :is(),:where(),:has() and :not()

Learn about several new pseudo-class selectors in CSS courtesy of @shubhamtiwari909's post here, complete with embedded CodePen examples.

{% embed https://dev.to/shubhamtiwari909/css-iswherehas-and-not-2afd %}


## A Guide to the Most Popular APIs

In this article, @pragativerma18 takes a look at how SOAP, REST, GraphQL, and gRPC APIs compare to each other, giving you a sense of their pros and cons. 

{% embed https://dev.to/pragativerma18/a-guide-to-the-most-popular-types-of-apis-rest-soap-graphql-and-grpc-4ail %}


## 36 Questions to Ask Your Future Software Employer

We’ve all felt that relief at the end of an interview, but then we get hit with “Do you have any questions for us?” and our minds draw a blank. @tomfern has some great questions for you to ask next time that happens!

{% embed https://dev.to/semaphore/36-questions-to-ask-your-future-software-employer-552g %}


## Why I don’t do TDD

@codenameone takes a critical look at TDD, outlining the good, the bad, and the worse. Ultimately, they don't use it or recommend it; here's why.

{% embed https://dev.to/codenameone/why-i-dont-do-tdd-1j71 %}


## The Right Image Format for your Next Project

Wondering what image format should you choose for your project? Luckily, @alvaromontoro has crafted an instructive and humorous decision tree to walk us through the process.

{% embed https://dev.to/alvaromontoro/what-image-format-should-you-use-in-your-next-project-1fd3 %}


## A 🦣 Opportunity for Developers

There's a lot of interest in Mastodon at the moment. Here are some thoughts from @andypiper on how to best capture that opportunity as a developer.

{% embed https://dev.to/andypiper/a-opportunity-for-developers-1ee4 %}


_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_
Technology changed the way that different generations communicate
Published: 2022-11-29 14:44:21

It would not be wrong to say that Technology has completely removed the barrier to communication for this generation.

From a time when people can communicate with limited resources and technology to the time when the world has become a global village, technology has changed the way of communication for different generations. With messaging and communication platforms, and smartphones with a lot of features, this generation can communicate easily.

Technology has brought the world closer. Now people prefer to communicate online and have access to smartphones to operate advanced technologies.

Hence, technology has made it easier for people to communicate.

**[xPal Secure Encrypted Messenger](https://blog.xpal.com/essential-features-of-xpal-secure-encrypted-messenger/)**  has an amazing feature of reverse PIN security. On installation of the app, it gives you an xPal ID and a PIN.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lv7kwicart8utkl66yyw.png)



You can then explore the xPal [Reverse PIN Security feature](https://www.xpal.com/). It allows you to completely remove your conversations from both ends sender and receiver in seconds.

All you need to do is just enter your security pin in reverse and all your conversations will be wiped out permanently from a single message to complete chats.

And above all, no notification will be sent to the other end.
How to create a Steps Wizzard in React
Tags: react
Published: 2022-11-29 13:30:18

This is a quick tutorial to show you the barebones of how to create a Wizzard Steps component. 

```tsx
import type { NextPage } from 'next';
import React, { useReducer } from 'react';

type StepsProps = {
  children: React.ReactNode;
};

const Steps = ({ children }: StepsProps) => {
  let idx = 0;

  const _children = React.Children.map(children, (child) => {
    if (!React.isValidElement(child)) return null;
    return React.cloneElement(child, { ...child.props, idx: ++idx });
  });

  return <div className="space-y-1">{_children}</div>;
};

type StepProps = {
  title: string;
  children: React.ReactNode;
  idx?: number;
};

const Step = ({ title, idx, children }: StepProps) => {
  return (
    <div className="border border-dashed border-gray-400 p-2">
      <div className="flex gap-2">
        <span className="bg-red-300 px-1">{idx}</span>
        <h4>{title}</h4>
      </div>
      <div className="mt-2">{children}</div>
    </div>
  );
};

const Home: NextPage = () => {
  const [hasWarranty, toggleWarranty] = useReducer((s) => !s, false);

  return (
    <div className="p-4">
      <h1 className="text-2xl">Checkout</h1>
      <button
        onClick={toggleWarranty}
        className="bg-gray-700 px-2 py-1 text-white"
      >
        Toggle Warranty Step
      </button>
      <div className="mt-3">
<Steps>
  <Step title="Contact Details">Step Details</Step>
  <Step title="Aditional Add-Ons">Step Details</Step>
  {hasWarranty && <Step title="Extended Warranty">Step Details</Step>}
  <Step title="Shipping Details">Step Details</Step>
  <Step title="Payment Details">Step Details</Step>
</Steps>
      </div>
    </div>
  );
};

export default Home;

```

Notice how the `<Steps/>` injects the idx into the `<Step/>` component without having to manually enter it.

```tsx
const Steps = ({ children }: StepsProps) => {
  let idx = 0;

  const _children = React.Children.map(children, (child) => {
    if (!React.isValidElement(child)) return null;
    return React.cloneElement(child, { ...child.props, idx: ++idx });
  });

  return <div className="space-y-1">{_children}</div>;
};
```

{% embed https://stackblitz.com/edit/github-h42qnf-8m87nj?file=pages/index.tsx %}