0

How to make a program that will accept 20 numbers and print last 5 inputs

7th Dec 2020, 1:20 PM
Joshua
2 Respuestas
+ 3
Setup a loop that runs 20 times Read number inside loop If the loop run to, or more than 15th times Print the number
7th Dec 2020, 1:31 PM
Ipang
+ 1
#Python # numbers=[int(i) for i in input("Enter numbers separated with a comma : ").split(",")] ### i used list comprehension here it will returns a list of numbers that user will enter print(numbers[-6:]) ### we are printing the last 6th numbers from the inputed numbers using list slicing [ : ]
7th Dec 2020, 4:12 PM
Ratnapal Shende
Ratnapal Shende - avatar