human
Find the final radiations of each Radiated Stations | Function to print the final radiations.
Function to create the array of the resultant radiations.
Resultant radiations.
Declaring index counter for left and right radiation.
Effective radiation for left and right case.
Radiation for i - th station.
Radiation increment for left stations.
Radiation increment for right stations.
Print the resultant radiation for each of the stations.
Driver code.
1 - based indexing"
How can the above be solved in Python?
assistant
#Here is code to find the final radiations of each Radiated Stations and the other steps required.
 def printf ( rStation , n ) :
	for i in range ( 1 , n + 1 , 1 ) :
		print ( rStation [ i ] , end = " ▁ " )
	print ( " " , ▁ end ▁ = ▁ "   " )
def radiated_Station ( station , n ) :
	rStation = [ 0 for i in range ( n + 1 ) ]
	for i in range ( 1 , n + 1 ) :
		li = i - 1
		ri = i + 1
		lRad = station [ i ] - 1
		rRad = station [ i ] - 1
		rStation [ i ] += station [ i ]
		while ( li >= 1 and lRad >= 1 ) :
			rStation [ li ] += lRad
			lRad -= 1
			li -= 1
		while ( ri <= n and rRad >= 1 ) :
			rStation [ ri ] += rRad
			rRad -= 1
			ri += 1
	printf ( rStation , n )
if __name__ == ' _ _ main _ _ ' :
	station = [ 0 , 7 , 9 , 12 , 2 , 5 ]
	n = len ( station ) - 1
	radiated_Station ( station , n )