Skip to main content

python float datatype - assigning a float value to a variable - floating-point value using float() class

 float datatype

python datatype
python float datatype


we can declare float variable in two ways

1)Directly assigning a float value to a variable

2)Using a float() class.


#Directly assigning a float value to a variable

intrest=1250.80

print("intrest is ",intrest)

print(type(intrest))

output:

    1250.80


# store a floating-point value using float() class

num = float(54)

print(num)

print(type(num))

output:

    54.0


Comments

Popular posts from this blog

Python Complex Datatypes

Python Complex Datatypes    A complex number is a number with a real and an imaginary component represented as a+bj where a and b contain integers or floating-point values. # both values are int type a = 9 + 8j           print(a)      print(type(a)) # one int and one float values b = 10 + 4.5j        print(b)       print(type(b)) # both values are float type c = 11.2 + 1.2j      print(c) print(type(c))

Python Opps Concepts: class and Object - Class and Objects in Python

Python Opps: class and Object Python Opps Concepts : Class and Object What is a Class and Objects in Python? Class: The class is a user-defined data structure that binds the data members and methods into a single unit. Class is a blueprint or code template for object creation. Using a class, you can create as many objects as you want Object: An object is an instance of a class. It is a collection of attributes (variables) and methods. We use the object of a class to perform actions.  #print name and age input from user using python object and class  EX: class person:     name=input("enter name")     age=input("enter age")     def __init__(self,name,age):         self.name=name         self.age=age     def greet(self):         #print("name ",self.name,"age",self.age)         print(f"{self.name} is {self.age} years old") a=person(person.name,person.age) a.greet...

Software Jobs - Web Developer jobs in Andhra Pradesh, Rajahmundry,

Software Jobs - Web Developer jobs in Andhra Pradesh, Rajahmundry,  Openings: Web Developer  Qualification: BE,Btech,MCA,MSC Experience: 1-5 years Requirements: Should have good experience as a PHP Application developer Hands on Experience in developing the application using MVC architecture. Good to have knowledge in MySQL, Codeignitor, Zend, CakePHP, Joomla, Magneto and Laravel is a plus. Have experience with REST API, JSON, and SOAP. Expertise in HTML5, CSS, Bootstrap, jQuery, Ajax. Experience in taking ownership of product delivery, code quality and architecture. Should be proactive, goal-oriented, reliable and a have a self-structured way of working. Responsibilities: Creating website layout/user interfaces by using standard HTML/CSS practices. Designing well organized databases. Integrating data from various back-end services and databases Be involved in al...