Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

float to int in python

# convert float to int 

int(2.0) #output :2  
Comment

python int string float

string = "3.5"
#integer = int(string) will not work, as that returns an error.
integer = int(float(string)) #This will work, as you first turn "3.5" to 3.5
                                     #then make it the integer 3
Comment

a int and float. python

#this is a int
the_int = 41

#this is a float
the_float = 3.937266272812163518356278
Comment

a int and float python


def aud_brl(amount, From, to):
    ER = 0.42108 
    if From.strip() == 'aud' and to.strip() == 'brl': 
        result = amount/ER 
    elif From.strip() == 'brl' and to.strip() == 'aud': 
        result = amount*ER 

    print(result)

def question(): 
    amount = float(input("Amount: "))
    From = input("From: ") 
    to = input("To: ")

    if (From == 'aud' or From == 'brl') and (to == 'aud' or to == 'brl'): 
        aud_brl(amount, From, to)

question()

Comment

a int and float python

a_int = 24 
#this is a int

a_float = 3.2883
#this is a float. you can see that it has a difference. it has a . :)
Comment

PREVIOUS NEXT
Code Example
Python :: how to kill somene 
Python :: python beautifulsoup get option tag value 
Python :: django login required 
Python :: binary tree in python 
Python :: staticmethod python 
Python :: flask run 
Python :: python towers of hanoi recursive 
Python :: multiplication of two or more numbers in python 
Python :: conv2 python 
Python :: how to remove role discord bot python 
Python :: python loop index and value 
Python :: python solve linear equation system 
Python :: Local to ISO 8601: 
Python :: python enumerate 
Python :: how to merge two column pandas 
Python :: how to find length of list python 
Python :: torch print full tensor 
Python :: read list stored as a string with pandas read csv 
Python :: Math Module pow() Function in python 
Python :: how to take space separated input in pyhon dicationary 
Python :: python -c 
Python :: get webpage python 
Python :: python not equal to symbol 
Python :: what are test cases in python 
Python :: pdf to string python 
Python :: pandas how to drop rows with extreme values in a single column 
Python :: rearrange columns pandas 
Python :: defaultdict python dict inside dict 
Python :: tkinter tutorial 
Python :: raw string python 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =