#Python Numbers variable
a=12 #print Variable as define format here define is an integer print (a) #output would be #12 #print Variable as integer convert from define format he a=12 is integer hence will print (int(a)) #output would be #12 #print variable as float value from integer as denine print (float(a)) #output would be #12.0 #print variable as complex value from integer as denine #https://docs.python.org/2/library/functions.html#complex print (complex(a)) #output would be #(12+0j) #for float value change to inter will work like as below b=12.12 print (int(b)) #output would be the integer value as #12 # How do we find the variable type from definirion of variable a=12 print (type(a)) #ouput would be #<class 'int'> a=12.1 print (type(a)) #ouput would be #<class 'float'> a=1+2J print (type(a)) #ouput would be #<class 'complex'> a=True print (type(a)) #ouput would be #<class 'bool'> |
Monday, June 3, 2019
Python Tutorial For Beginners : Section -1
Subscribe to:
Post Comments (Atom)
Wireless Security Configuration: Protect Your Network Now!
Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...
-
sudo apt update sudo apt install ubuntu-desktop sudo apt install tightvncserver sudo apt install gnome-panel gnome-settings-daemon metac...
-
How to Setup GUI on Amazon EC2 Ubuntu Server Amazon EC2 Linux servers do not come with GUI, all the operations have to be done using ssh co...
-
Amazon ElastiCache Managed, in-memory data store services. Choose Redis or Memcached to power real-time applications. Amazon...
No comments:
Post a Comment