Python Program to swap first half with the second half of list only if sum of first half is greater

preview_player
Показать описание
In this video, you will understand the program to write a method in python named SwapHalfList(Array) , which accepts a list
of numbers (even) and swaps the elements of 1st Half of the list with the 2nd Half of the list ONLY if the sum of 1st Half is greater than 2nd Half of the list.
Sample Input Data of the list
Array= [ 100, 200, 300, 40, 50, 60],
Output Array = [40, 50, 60, 100, 200, 300]

Join this channel to get access to perks:

YT 1k Sub.
Channel Trailer video

random module

Mathematical and String Functions

Using Python Libraries:

Data Structures: Stack and Queue

File Handling:

Recursion

Idea of Algorithmic Efficiency

Interface Python with MYSQL:

MYSQL
Computer Networks:

Programming Corner:
Output Based Questions:

Boolean Algebra

Basics of Python

Flow of Control

String Manipulation

List Manipulation

Dictionaries

Sorting
Рекомендации по теме
Комментарии
Автор

MAM YOUR EXPLANATIONS ARE ALWAYS CRYSTAL CLEAR. EVEN I WHO USED TO HAVE GREAT DIFFICULTY IN UNDERSTANDING THIS TYPE
OF PROGRAMS EARLIER;NOW I CAN EASYLY UNDERSTAND WATCHING YOUR VIDEOS... AND I NOW THINK ITS VERY EASY SOLVING THIS KINDA PROBLEMS.
THANK YOU FOR YOUR MARVELOUS EFFORT.

havocislive
Автор

I have no words for u r excellence, crystal clear concepts, great knowledge.
U r superb.u r the great great great computer science teacher.and in last very cute and very smart 🤓

Deepak-quuq
Автор

l=eval(input('Enter a list of elements:'))
h=len(l)//2
l1=l[:h]
l2=l[h:]
print('new', [l2+l1])

is this good mam ?

suso
Автор

Thankyou so much maam for this question because this question is come on my preboard exam. Maam please upload some new programming question that come in previous exams .

komalbaliyan
Автор

Mam hm program always on the basis of input sample likhte. Hai kya.

VardhanMittal
Автор

Mam one small doubt mam when we put condition on i and when arr[i] whats difference in this. In push pop we put condition on i but in function putting in different way.

VardhanMittal
Автор

We can use string slicing to shortens code

mrwordpress
Автор

Maam i have been searching many videos for cs class 12 for 2020-21 boards exam and i am very confused about the deleted and revised syallabus since the textbook have too much content so i cannot refer it. Maam ur class 12 videos are for 2020-21 .
Maam if i study from them will my portion be over.

chandravirsinghbhadoria
Автор

Mam can u pls tell the program to exchange first half of list elements with second half elements assuming list has even number of pls tell what changes we have to done in this program so that it works for my above please please reply

vanshikaparjapati
Автор

I'm still unable to understand it 😥

satishchaube
Автор

mam can you provide me the video for Input a list of numbers and swap elements at the even location with the elements at the odd location.
please

akhilpratapsinghtomar
welcome to shbcf.ru