top of page
Search

Integers and Floasts in Python

Writer's picture: Abhinaw TripathiAbhinaw Tripathi

Defining integers in Python is very easy. eg: answer=42 pi=3.14159 Python 3 also introduces complex numbers as a type.There is no real need to worry about types in Python.atleast not in the beginning. answer + pi = 45.14159 # Don't worry about conversion ! you can seamlessly add integers, float .pyhton does not complain about it.it will produce desired results.And to cast anything.just have to do something like this. int(pi) == 3 float(answer) == 42.0 this is needed when we really want to cast the integer and float variables. 


8 views0 comments

Recent Posts

See All

Lambda Functions in Python

So Lambda Functions are just an anonymous function.they are very simple just saves your space and time.they are useful in case of higher ...

Generator Function - Yield Python

So Yield is a keyword.first let's take an example. student = [] def read_file(): try: f=open("students.txt","r") for student in...

Opening,Reading and Writing Python

Let's save our data in a file and read from that file again when we re-open our app. So let's take an example: Let's take an example: ...

© 2016 by Abhinav Tripathi

  • Facebook Clean Grey
  • Twitter Clean Grey
bottom of page