teleren/devto huggingface dataset:
12. Trade Commissions (Switch Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:42:50

```cs
using System;

namespace TradeCommissions_Switch
{
internal class Program
{
    static void Main(string[] args)
    {
        string city = Console.ReadLine();
        double sales = double.Parse(Console.ReadLine());

        switch (city)
        {
            case "Sofia":
                if (sales >= 0 && sales <= 500)
                {
                    sales *= 0.05;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 500 && sales <= 1_000)
                {
                    sales *= 0.07;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 1_000 && sales <= 10_000)
                {
                    sales *= 0.08;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 10_000)
                {
                    sales *= 0.12;
                    Console.WriteLine($"{sales:F2}");
                }
                else
                {
                    Console.WriteLine("error");
                }
                break;

            case "Varna":
                if (sales >= 0 && sales <= 500)
                {
                    sales *= 0.045;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 500 && sales <= 1_000)
                {
                    sales *= 0.075;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 1_000 && sales <= 10_000)
                {
                    sales *= 0.1;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 10_000)
                {
                    sales *= 0.13;
                    Console.WriteLine($"{sales:F2}");
                }
                else
                {
                    Console.WriteLine("error");
                }
                break;

            case "Plovdiv":
                if (sales >= 0 && sales <= 500)
                {
                    sales *= 0.055;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 500 && sales <= 1_000)
                {
                    sales *= 0.08;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 1_000 && sales <= 10_000)
                {
                    sales *= 0.12;
                    Console.WriteLine($"{sales:F2}");
                }
                else if (sales > 10_000)
                {
                    sales *= 0.145;
                    Console.WriteLine($"{sales:F2}");
                }
                else
                {
                    Console.WriteLine("error");
                }
                break;

            default:
                Console.WriteLine("error");
                break;
        }
    }
}
}
```
7. Working Hours (Short Solution)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:35:15

```cs
using System;

namespace WorkingHours
{
class Program
{
    static void Main(string[] args)
    {
        int hour = int.Parse(Console.ReadLine());
        string weekDay = Console.ReadLine();

        if ((hour >= 10 && hour <= 18) && weekDay != "Sunday")
        {
            Console.WriteLine("open");
        }
        else
        {
            Console.WriteLine("closed");
        }
    }
}
}
```
Hosting Your Application the Right Way: An Overview to Hosting Compute Power in the Cloud to Save Money and Time
Tags: cloud, architecture, beginners, writing
Published: 2023-01-20 23:42:35

Ready to take your software to the cloud? ☁️
Don't get stuck choosing the right option for hosting compute power in the cloud! 🚀 

Get the insights you need, make an informed decision and scale your application like never before! 📈  

---

Deciding on how to host your computing power in the cloud is extremely hard.

As a software founder, you have three main options for hosting your computer in the cloud. Choosing one over the other can have a massive impact on your architecture.

Also, finding the best fit can be challenging because each option has specific benefits and drawbacks. However, by understanding the pros and cons of each option, you can make an informed decision that will speed up development, save money, and scale your application.

## VMs allow for a simple 1-to-1 translation into the cloud.

The most straightforward type of cloud computing is virtual machines.

You get a virtual server with a minimal operating system that you can set up and **use just like a regular computer**. VMs require the most management, but they give you the most control. When you are currently using classic servers and want to make a seamless transition to the cloud, VMs are advised.

If you want to switch to the cloud without making any other changes, use VMs.

## Containers provide a simple, portable package that runs everywhere.

Containers allow you to package software and run it anywhere.

Using containers makes moving your workload to the cloud from an existing environment straightforward. You can also expect the same runtime behavior everywhere because the container contains all its dependencies. Furthermore, **containers can easily be stopped, restarted, or autoscaled in response to demand.**

This choice is excellent if you want a portable, modular system.

## Serverless systems allow you to focus on the application rather than the infrastructure.

You can run your application on serverless platforms without managing any infrastructure.

Utilizing managed services and cloud functions allows for this. Cloud functions are functions that run once when you call them. As they don't have any state, they write data to a database for persistent storage. Given that the functions are only activated when called, this **enables almost infinite scaling and a true pay-per-use model**.

Serverless Systems are best when you don't need long sessions or want true scalability.
12. Trade Commissions (If Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:42:14

```cs
using System;

namespace TradeCommissions
{
internal class Program
{
    static void Main(string[] args)
    {
        string city = Console.ReadLine();
        double sales = double.Parse(Console.ReadLine());

        if (city == "Sofia")
        {
            if (sales >= 0 && sales <= 500)
            {
                sales *= 0.05;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 500 && sales <= 1_000)
            {
                sales *= 0.07;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 1_000 && sales <= 10_000)
            {
                sales *= 0.08;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 10_000)
            {
                sales *= 0.12;
                Console.WriteLine($"{sales:F2}");
            }
            else
            {
                Console.WriteLine("error");
            }
        }
        else if (city == "Varna")
        {
            if (sales >= 0 && sales <= 500)
            {
                sales *= 0.045;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 500 && sales <= 1_000)
            {
                sales *= 0.075;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 1_000 && sales <= 10_000)
            {
                sales *= 0.1;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 10_000)
            {
                sales *= 0.13;
                Console.WriteLine($"{sales:F2}");
            }
            else
            {
                Console.WriteLine("error");
            }
        }
        else if (city == "Plovdiv")
        {
            if (sales >= 0 && sales <= 500)
            {
                sales *= 0.055;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 500 && sales <= 1_000)
            {
                sales *= 0.08;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 1_000 && sales <= 10_000)
            {
                sales *= 0.12;
                Console.WriteLine($"{sales:F2}");
            }
            else if (sales > 10_000)
            {
                sales *= 0.145;
                Console.WriteLine($"{sales:F2}");
            }
            else
            {
                Console.WriteLine("error");
            }
        }
        else
        {
            Console.WriteLine("error");
        }
    }
}
}
```
11. Fruit Shop (If Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:40:30

```cs
using System;

namespace FruitShop
{
internal class Program
{
    static void Main(string[] args)
    {
        string fruit = Console.ReadLine();
        string weekDay = Console.ReadLine();
        double quantity = double.Parse(Console.ReadLine());

        double price = 0.0;

        if (weekDay == "Monday" || weekDay == "Tuesday" || weekDay == "Wednesday"
            || weekDay == "Thursday" || weekDay == "Friday")
        {
            if (fruit == "banana")
            {
                price = quantity * 2.50;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "apple")
            {
                price = quantity * 1.20;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "orange")
            {
                price = quantity * 0.85;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "grapefruit")
            {
                price = quantity * 1.45;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "kiwi")
            {
                price = quantity * 2.70;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "pineapple")
            {
                price = quantity * 5.50;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "grapes")
            {
                price = quantity * 3.85;
                Console.WriteLine($"{price:F2}");

            }
            else
            {
                Console.WriteLine("error");
            }
        }
        else if (weekDay == "Saturday" || weekDay == "Sunday")
        {
            if (fruit == "banana")
            {
                price = quantity * 2.70;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "apple")
            {
                price = quantity * 1.25;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "orange")
            {
                price = quantity * 0.90;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "grapefruit")
            {
                price = quantity * 1.60;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "kiwi")
            {
                price = quantity * 3.00;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "pineapple")
            {
                price = quantity * 5.60;
                Console.WriteLine($"{price:F2}");

            }
            else if (fruit == "grapes")
            {
                price = quantity * 4.20;
                Console.WriteLine($"{price:F2}");

            }
            else
            {Console.WriteLine("error");
            }
        }
        else
        {
            Console.WriteLine("error");
        }

    }
}
}
```
JS Pipeline Operator
Tags: discuss, javascript
Published: 2023-01-20 23:40:10

What are your thoughts on the new Pipeline operator being proposed for JavaScript?

Currently they are working out the flavor of the syntax. Looks like it's between Hack and F# syntax.

### Hack Flavor
Provides explicit placeholders. The operation pipes the previous result to the parameter holding the `%` sign. 

```js
value |> one(%) |> two(%) |> three(%)

value 
|> one('foo', %) 
|> two('bar', %) 
|> three('baz', %)
```

### F# Flavor
Provides implicit syntax but could easily be paired with lambdas for more complex pipelines.

```js
value |> one |> two |> three

value 
|> x => one('foo', x) 
|> x => two('bar', x) 
|> x => three('baz', x)
```


### My Hot Take
Personally I don't like the Hack Flavor. I mainly crave the implicit syntax from F#. Adding an explicit special character to act as a placeholder seems rather annoying.

However, it sounds like the F# flavor comes with some performance pitfalls and could be more difficult to use with async code.

What do you think?
[Hands-On!] Create a customizable developer workflow
Tags: tooling, performance, productivity, serverless
Published: 2023-01-20 23:38:45

Hi devs!

Happy new year and I hope you all had great holidays!
Let's start the year with a fresh new Hand-On session, where you can learn how to create a customizable developer workflow, using a Developer Control Plane, developed by [CTO.ai](https://cto.ai/).

Here's the agenda:

✅ Understand the concepts of Commands, Pipelines, and Services and how does it apply to the Developer Control Plane;
✅ Create workflows from zero to hero
✅ Customize a workflow to deploy from GitHub, Slack, or CLI
✅ Using deployment data to calculate and measure delivery performance
✅ Other case scenarios: rollback of services and secrets + configs management
✅ Open source workflows to get started

That's a good opportunity to learn about the Platform and how it can benefit your daily work with tools that you already use!

It's going to be 30 min of Hands-On + QA, on **January 31st at 3:30 PM EST**.

You can [subscribe here](https://cto-ai.zoom.us/webinar/register/WN_yJ35jr2gSw6N43sTJ1PVig?utm_content=234976388&utm_medium=social&utm_source=linkedin&hss_channel=lcp-18278566).

Join us and I will see you there! :)
9. Fruit or Vegetable (Switch Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:38:24

```cs
using System;

namespace FruitOrVegetable_Switch_
{
internal class Program
{
    static void Main(string[] args)
    {
        string product = Console.ReadLine();

        switch (product)
        {
            case "banana":
            case "apple":
            case "kiwi":
            case "cherry":
            case "lemon":
            case "grapes":
                Console.WriteLine("fruit");
                break;

            case "tomato":
            case "cucumber":
            case "pepper":
            case "carrot":
                Console.WriteLine("vegetable");
                break;

            default:
                Console.WriteLine("unknown");
                break;
        }
    }
}
}
```
9. Fruit or Vegetable (If Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:37:23

```cs
using System;

namespace FruitOrVegetable_If_
{
internal class Program
{
    static void Main(string[] args)
    {
        string product = Console.ReadLine();

        if (product == "banana" || product == "apple" || product == "kiwi" || product == "cherry" || product == "lemon" || product == "grapes")
        {
            Console.WriteLine("fruit");
        }
        else if (product == "tomato" || product == "cucumber" || product == "pepper" || product == "carrot")
        {
            Console.WriteLine("vegetable");
        }
        else
        {
            Console.WriteLine("unknown");
        }
    }
}
}
```
8. Cinema Ticket (Switch Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:36:37

```cs
using System;

namespace CinemaTicket_Switch
{
internal class Program
{
    static void Main(string[] args)
    {
        string weekDay = Console.ReadLine();

        switch (weekDay)
        {
            case "Monday":
            case "Tuesday":
            case "Friday":
                Console.WriteLine("12");
                break;

            case "Wednesday":
            case "Thursday":
                Console.WriteLine("14");
                break;

            case "Saturday":
            case "Sunday":
                Console.WriteLine("16");
                break;
        }

    }
}
}
```
8. Cinema Ticket (If Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:35:59

```cs
using System;

namespace CinemaTicket
{
internal class Program
{
    static void Main(string[] args)
    {
        string weekDay = Console.ReadLine();

        if (weekDay == "Monday")
        {
            Console.WriteLine("12");
        }
        else if (weekDay == "Tuesday")
        {
            Console.WriteLine("12");
        }
        else if (weekDay == "Wednesday")
        {
            Console.WriteLine("14");
        }
        else if (weekDay == "Thursday")
        {
            Console.WriteLine("14");
        }
        else if (weekDay == "Friday")
        {
            Console.WriteLine("12");
        }
        else if (weekDay == "Saturday")
        {
            Console.WriteLine("16");
        }
        else if (weekDay == "Sunday")
        {
            Console.WriteLine("16");
        }
    }
}
}
```
7. Working Hours (Long Solution)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:34:01

```cs
using System;

namespace WorkingHours
{
internal class Program
{
    static void Main(string[] args)
    {
        int dayHour = int.Parse(Console.ReadLine());
        string weekDay = Console.ReadLine();

        switch (weekDay)
        {
            case "Monday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Tuesday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Wednesday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Thursday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Friday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Saturday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("open");
                }
                else
                {
                    Console.WriteLine("closed");
                }
                break;

            case "Sunday":
                if (dayHour >= 10 && dayHour <= 18)
                {
                    Console.WriteLine("closed");
                }
                break;
                
        }
    }
}
}
```
6. Number in Range
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:32:07

```cs
using System;

namespace NumberInRange
{
internal class Program
{
    static void Main(string[] args)
    {
        int number = int.Parse(Console.ReadLine());

        if (number >= -100 && number != 0 && number <= 100)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}
}
```
5. Small Shop
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:31:26

```cs
using System;

namespace SmallShop
{
internal class Program
{
    static void Main(string[] args)
    {
        string product = Console.ReadLine();
        string city = Console.ReadLine();
        double quantity = double.Parse(Console.ReadLine());

        double price = 0.0;

        if (city == "Sofia")
        {
            if (product == "coffee")
            {
                price = quantity * 0.50;
            }
            else if (product == "water")
            {
                price = quantity * 0.80;
            }
            else if (product == "beer")
            {
                price = quantity * 1.20;
            }
            else if (product == "sweets")
            {
                price = quantity * 1.45;
            }
            else if (product == "peanuts")
            {
                price = quantity * 1.60;
            }
        }
        else if (city == "Plovdiv")
        {
            if (product == "coffee")
            {
                price = quantity * 0.40;
            }
            else if (product == "water")
            {
                price = quantity * 0.70;
            }
            else if (product == "beer")
            {
                price = quantity * 1.15;
            }
            else if (product == "sweets")
            {
                price = quantity * 1.30;
            }
            else if (product == "peanuts")
            {
                price = quantity * 1.50;
            }
        }
        else if (city == "Varna")
        {
            if (product == "coffee")
            {
                price = quantity * 0.45;
            }
            else if (product == "water")
            {
                price = quantity * 0.70;
            }
            else if (product == "beer")
            {
                price = quantity * 1.10;
            }
            else if (product == "sweets")
            {
                price = quantity * 1.35;
            }
            else if (product == "peanuts")
            {
                price = quantity * 1.55;
            }
        }

        Console.WriteLine(Math.Abs(price));
    }
}
}
```
4. Personal Titles (If Construction)`
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:30:35

```cs
using System;

namespace PersonalTitles_If_
{
internal class Program
{
    static void Main(string[] args)
    {
        double years = double.Parse(Console.ReadLine());
        char gender = char.Parse(Console.ReadLine());

        if (years >= 16 && gender == 'm')
        {
            Console.WriteLine("Mr.");
        }
        else if (years < 16 && gender == 'm')
        {
            Console.WriteLine("Master");
        }
        else if (years >= 16 && gender == 'f')
        {
            Console.WriteLine("Ms.");
        }
        else if (years < 16 && gender == 'f')
        {
            Console.WriteLine("Miss");
        }
    }
}
}
```
3. Animal Type (If Construction)
Tags: csharp, softuni, conditionalstatementsadvanced, lab
Published: 2023-01-20 23:29:31

```cs
using System;

namespace AnimalType_If_
{
internal class Program
{
    static void Main(string[] args)
    {
        string animal = Console.ReadLine();

        if (animal == "dog")
        {
            Console.WriteLine("mammal");
        }
        else if (animal == "crocodile" || animal == "tortoise" || animal == "snake")
        {
            Console.WriteLine("reptile");
        }
        else
        {
            Console.WriteLine("unknown");
        }
    }
}
}
```