Skip to main content

How to sum of two arrays in Python3:




Input Format:

The first line of the input contains a number N representing the number of elements in array A.
The second line of the input contains N numbers separated by a space. (after the last elements, there is no space)

Output Format:

Print the resultant array elements separated by a space. (no space after the last element)

Example:

Input:
4
2 5 3 1

Output:
3883

Explanation:
Here array A is [1,2,3,4] and reverse of this array is [4,3,2,1] and hence the resultant array is [5,5,5,5] 

SOURCE CODE:

import math
size=int(input())
list1=[]

for x in input().split():
  num=int(x)
  list1=list1+[num]
 
for i in range(math.ceil(size/2)):
    list1[i]=list1[size-1-i]=list1[i]+list1[size-1-i]
   
for i in range(size-1):
      print(list1[i],end=" ")
     
print(list1[size-1],end="")

Comments

Popular posts from this blog

Top 5 Online Jobs Working from Home in 2020

I know you all have your own dreams and passion. But you are unable to follow your dreams and passion. There are some reasons Firstly ,  you think that " If you follow your dreams and passion then can you become a successful person in future ?" because you can't getting sufficient courage to make fulfill your dreams and passion. Secondly , "for some family reasons you are unable to follow your passion and dreams , am i right ?"  Without this two reasons you can have more reasons. But i suggest you that , you must follow your dreams and passion because you have interest on that. So , if you searching best online job working from home then this blog maybe help you. There are many scopes but, here i explain top 5 online jobs working from home.  Are you still reading ? then you have interest. So, hi this is Santanu from Tech Pathsala. You are reading Tech Pathsala blog. Without wasting more time lets get started. Table of contents Become a Freelancer Become a YouTub...

Know about Fuchsia OS

Fuchsia is a capability-based operating system currently being developed by Google. It first became known to the public when the project appeared on GitHub in August 2016 without any official announcement. In contrast to prior Google-developed operating systems such as Chrome OS and Android, which are based on the Linux Kernel, Fuchsia is based on a new microkernel called "Zircon". The GitHub project suggests Fuchsia can run on many platforms, from embedded systems to smartphones, tablets, and personal computers. In May 2017, Fuchsia was updated with a user interface, along with a developer writing that the project was not a "dumping ground of a dead thing", prompting media speculation about Google's intentions with the operating system, including the possibility of it replacing Android. Fuchsia is also a future based operating system,it will be grow or famous than android operating system and vice versa. Fuchsia OS is written by C,C++,Go,Rust,...

What Is Top 10 Headphones In 2020 really All About?

If you are looking best Headphones in  2020 under low  budget but you don't know which headphone will be the best for yours , then I suggest to you 10 best headphones, which will be the best for you. Hi this is Santanu From Tech Pathsala . You are reading Tech Pathsala blog. Without  wasting more time lets get started. 1.  boAt Rockerz 510 Bluetooth Headphone with Thumping Bass, Up to 10H Playtime, Dual Connectivity Modes, Easy Access Controls and Ergonomic Design (Raging Red) Product description: Now just stop worrying about Wires hanging from here and  there. Pair with any Bluetooth device, connect and play.  Dead Batteries can kill your vibe. boAt Rockerz 510 is designed to play Up to 10 hours. Don't just be loud, be loud and clear. We assure you have not heard such powerful bass and vocal clarity from a wireless headphone with Extra Comfort Ear cups.  The boAt Super Bass Rockerz510 Wireless Headphones will  make your listening experience perso...