Python 3 Пузырьковая сортировка в обе стороны

Задание: Напишите функцию bubble(lst, a=False), которая принимает один обязательный аргумент – список из чисел, выполняет сортировку списка методом пузырька и возвращает получившийся список.

Аргумент desc задает порядок сортировки. Если он равен True, то функция сортирует по убыванию, если он равен False, то – по возрастанию.

По умолчанию функция сортирует список по возрастанию.

Запрещено использовать встроенные возможности языка для сортировки.

Нужна только функция ввод/вывод реализовывать не нужно

Подскажите, пжл, что не так с моим вариантом?

def bubble(lst, a=False):   if desc:     for i in range(len(lst)-1):       for j in range(len(lst)-i-1):         if lst[j] > lst[j+1]:           lst[j], lst[j+1] = lst[j+1], lst[j]   elif not desc:       for i in range(len(lst)-1):         for j in range(len(lst)-i-1):           if lst[j] > lst[j+1]:             lst[j], lst[j+1] = lst[j+1], lst[j]   return lst 

Anonymous function uses variable declared outside the function?

Please see the code below, which I have taken and adapted from here: https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html and here: https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/dotnet (RPCServer and RPCClient):

public RpcClient()         {             var factory = new ConnectionFactory() { HostName = "localhost" };              connection = factory.CreateConnection();             channel = connection.CreateModel();             replyQueueName = channel.QueueDeclare().QueueName;             consumer = new EventingBasicConsumer(channel);             List<String> responses = new List<string>();             consumer.Received += (model, ea) =>             {                 var body = ea.Body;                 var response = Encoding.UTF8.GetString(body);                  responses.Add(response);                 if (responses.Count == 2)                 {                     if (!callbackMapper.TryRemove(ea.BasicProperties.CorrelationId, out TaskCompletionSource<List<string>> tcs))                         return;                     tcs.TrySetResult(responses);                 }                 else                     return;             };         } 

This is a Scatter Gather (https://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html). Notice that the list of responses is defined outside of consumer.Received. Are there any pitfalls doing this that I have not considered?

Magento 2 Images Not Showing on Product Detail page Please Advice

I have installed Magento 2.1.6 and had lot’s of products over it. then i download fresh copy of magento 2.1.7 from magento market place and extracted and used my previous database that was had lot’s of products and order histories etc.

the website start working fine . now i migrate Media folder from old website directory to new website directory same in pub folder

now images start working fine. but when i see on product detail page images not showing else all images showing any help?

Python, my calculator wont work can you tell me whats wrong?

so I made this calculator and if you copy past it and run it you can see when you enter an operator that is invalid which are + – * /, it doesn’t work.

num1 = float(input("Enter the first number: ")) op = input("Enter operator: ") while op != "+" or "-" or "/" or "*":     print("\t\tOperator can only be : +, -, /, *.")     op = input("Enter Operator")  num2 = float(input("Enter the second number: "))  if op == "+":     print(num1 + num2) elif op == "-":     print(num1 - num2) elif op == "/":     print(num1 / num2) elif op == "*":     print(num1 * num2) 

I know the problem is the loop at the code line, while op != “+” or “-” or “/” or “*”:

so why when I put in a valid operator it loops it again and doesn’t move on? Thanks so much for the help.

Can a Damphir use the spell or effects of Cure Wounds on him/herself and by pass there Negative Energy Affinity?

Can a good aligned Damphir use the spell or effects of Cure Wounds on him/herself and bypass their Negative Energy Affinity or would you still need the Life-Dominant Soul feat to at least heal for half?

Negative Energy Affinity (Ex): The creature is alive, but is treated as undead for all effects that affect undead differently than living creatures, such as cure spells and channeled energy.

>

Life-Dominant Soul Prerequisite: Dhampir

Benefit: You are healed by channeled positive energy used to heal living creatures and channeled negative energy used to heal undead, but both only heal half the normal amount. You still take damage from positive energy used to harm undead, such as that from channeled energy and lay on hands.

Ex: a Damphir Cleric or Bard

using a potion or scroll

using a strike or Boost from the Silver Crane discipline for Path of War

Path of War: Silver Crane

Complete Edit Form refresh in C# code

I’m back with another problem. 😉

I managed to create a list with a multi lookup to another list, containing some labels. I added a webpart to list A’s edit form to allow direct adding of labels to List B, with the intention of the added values showing up in the lookup immediatly.

First, I try to add a new label by filling in the textbox and clicking Create, as shown here: http://imgur.com/2duDbM3,hB8OCFo#2

However, the page then reloads, showing the lookup columns to be both empty, like here: http://imgur.com/2duDbM3,hB8OCFo#1

Is there anyway I can force a full refresh of the page via C# code behind the Create button that will make this page show up correctly?

Thanks in advance! David

Visiting the UK as unmarried couple

My girlfriend and I both have Ukrainian citizenship. We’re planning to visit the UK at the end of April. While filling in the application form for visitor visa we specified our relationship status as unmarried partners since we have been living together for more than 3 years and I’m going to be her sponsor. Closer to visa appointment I started to google some information, like what documents we should bring to prove our relationship etc. All the information that pops out is about the case when a person already settled in the UK wants to bring his partner. Did we fill in the form right?

(DUDA) Unir arrays de longitud indefinida C++

buenas;

Haciendo un trabajo para la universidad me he visto en la necesidad de unir dos arrays de tipo double (double array1, double array2) y unir ambos para pasarlos a un tercer vector (double array3).

El ejercicio consiste en definir al principio dos vectores de tipo double y hacer una funcion que los una en un tercero. Con este tercero (tambien indefinido (longitud array3 = lon array1 + lon array2)) se debe dar su longitud o cantidad de elementos que contiene

GRACIAS