write a Python program to create a list of 10 floating point numbers and print all but the last 4 numbers?
How we can write a python program to create a list of 10 floating point numbers and print the last four numbers.
Python is a Programming language. it was created by guido van rossum and it is released in 1991. Python is a simple programming language compare to other programming language.
Let’s See an example of it :
This program is simple let see step by step how it works.
Step1 : Firstly create a list of 10 floating point number.
Step2 : Then we can use a range function the range() function returns the sequence of a number. in range function I have used len function it will return the length of the object.
Step3: In the for loop I have passed len(x) function. the len(x) return how many number s are present in the x. the indexing start with ‘0′ so the numbers are present in the x is 10.
Note : Always remember one point in python that is indentation. without indentation the compiler shows it is an indentation an error.
Comments
Post a Comment