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 :: csv manipulation python 
Python :: get reactions from message discord.py 
Python :: matrix diagonal sum python 
Python :: read a csv file in pandas 
Python :: pandas reset index start from 0 
Python :: python between inheritance and composition 
Python :: boxplot python 
Python :: flask on gevent over https 
Python :: decimal to binary python 
Python :: how to strip whitespace in python 
Python :: python removing duplicate item 
Python :: df concat multiple columns 
Python :: python slice list 
Python :: django form field class 
Python :: pandas df.to_csv() accent in columns name 
Python :: strptime python 
Python :: shuffle text lines python 
Python :: round to nearest multiple of 5 python 
Python :: matplotlib: use colormaps for line plot colors 
Python :: messages in django 
Python :: creating a python virtual environment 
Python :: circular cropping of image in python 
Python :: python in stack 
Python :: python fiboncci 
Python :: python timestamp to string 
Python :: List Comprehension generate a list 
Python :: casting in python 
Python :: sumof product 1 
Python :: test django migrations without applying them 
Python :: pytorch multiply tensors element by elementwise 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =