Write a program to replace every element with the greatest element on right side
A = list(map(int,input("Enter the numbers: ").split())) #map returns the object.It passes elements from 2nd arguement to 1st. N=len(A) for i in range(N): temp=A[i] for j in range(i,N): if A[j]>temp: A[i]=A[j] break print(A) ''' Input: Enter the numbers: 16 17 4 3 5 2 Output: [17, 17, 5, 5, 5, 2] '''
Scrshot
Output:
Enter the numbers: 16 17 4 3 5 2
[17, 17, 5, 5, 5, 2]
Output:
Enter the numbers: 22 550 60 30 20
[550, 550, 60, 30, 20]
Output:
Enter the numbers: 65 65 32 10
[65, 65, 32, 10]
Output:
Enter the numbers: 5 6 2 0 1
[6, 6, 2, 1, 1]
Output:
Enter the numbers: 68 95 45 2 10
[95, 95, 45, 10, 10]
More Codes to Fcuk
- Armstrong Number
- Find the biggest even number
- Program to replace every element on right side
- Compute the frequency of the note
- Print all Possible Combinations from three Digits.
- Get number n and Compute n+nn+nnn
- Print Cube root of the given number
- Convert number into binary, octal and hexa
- Return maximum number of operations performed on array.
- Determine the encryption key
- Find the count of numbers having a prime number in their binary representation.
- Fibonacci Series up to given n numbers
- Help Alice find the route to her home
Explore
- Quantum Mechanics relation with quantum computing
- Unzipping Files using Python
- An Algorithm which accepts n integer values and calculates the average and prints it.
- How can Quantum Computing merge with Virtual Reality ? !
- Blockchain and Cryptocurrency. And their relations with Virtual Reality !!