Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

int():

Vinay Rawal answered on April 1, 2023 Popularity 6/10 Helpfulness 1/10

Contents


More Related Answers

  • int a=08 java
  • unsigned integer
  • java unsigned int
  • int[] java
  • java int
  • what is an integer
  • int[] java
  • int[]
  • java what is integer
  • java unsigned int
  • java int
  • integer class in java
  • int a=0; int b=30;
  • how to use int
  • int a=08 java
  • unsigned int java
  • int... in java
  • Using int type
  • int a=0; int b=30;
  • java integer asint
  • (int i=0;
  • int in java

  • int():

    0

    We can use this function to convert values from other types to int 1) >>> int(123.987) 2) 123 3) >>> int(10+5j) 4) TypeError: can't convert complex to int 5) >>> int(True) 6) 1 7) >>> int(False) 8) 0 9) >>> int("10") 10) 10 11) >>> int("10.5") 12) ValueError: invalid literal for int() with base 10: '10.5' 13) >>> int("ten") 14) ValueError: invalid literal for int() with base 10: 'ten' 15) >>> int("0B1111") 16) ValueError: invalid literal for int() with base 10: '0B1111' Note:

    1) We can convert from any type to int except complex type. 2) If we want to convert str type to int type, compulsary str should contain only integral value and should be specified in base-10. 

    Popularity 6/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Apr 01 2023
    Vinay Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.