Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

converting datatypes

x = "3"
int(x)

y = "2.6"
float(y)

z = "1j"
complex(z)

print(typeof(x))
# Int
# float
# complex
Comment

Converting Data Types

+++++++++++++++++++++++++++++++++++++++++++++++
first_number = input("Input your first number:")
second_number = input("Input your second number:")

print(first_number + second_number)
++++++++++++++++++++++++++++++++++++++++++++++++++
first_number = int(input("Input your first number:"))
second_number = int(input("Input your second number:"))

print(first_number + second_number)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
my_number = 5
my_string = "5"

print(my_string + str(my_number))
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comment

PREVIOUS NEXT
Code Example
Python :: singke line expresions python 
Python :: get type of enum variable python 
Python :: pandas combine bool columns 
Python :: typing effect python 
Python :: _tkinter.TclError: invalid command name ".!canvas" 
Python :: KeyError: 0 python 
Python :: python without creating pyc 
Python :: python return inline if 
Python :: how to close python in terminal 
Python :: ring convert string lines to list items and convert the list to a string 
Python :: function to find the mean of column in dataframe in python 
Python :: for loop the string from reverse order and skipping last element in string python 
Python :: gfxdraw circle weight 
Python :: get correlation between two signals 1d scipy 
Python :: python alphabet to number 
Python :: insertar valor python 
Python :: create a separate dataframe with the columns 
Python :: obtenir coordonnees souris python 
Python :: trello class 
Python :: tf.stop_gradient in pytorch 
Python :: how to load images from folder in python 
Python :: python notification image 
Python :: orm odoo 
Python :: vijay 
Python :: vs code notes extension 
Python :: jumpssh execute multiple commands 
Python :: python format inverse 
Python :: REMINER VIA MAIL 
Python :: how to convert input time value to datetime 
Python :: How to Empty a Set in Python Using the clear() Method 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =