fb pixel

Introduction to Python

  • Profound Academy

    • Status
      • 1
        Input and Output
      • 2
        Variables and Integer Arithmetic
      • 3
        Conditional Operators
      • 4
        Advanced Conditions - Nesting
      • 5
        Types and Variables
      • 6
        Strings
      • 7
        Lists
      • 8
        For Loops
      • 9
        While Loops
      • 10
        continue, break, while...else
      • 11
        String and List methods
      • 12
        Nested Loops
      • 13
        List Comprehension
      • 14
        Tuples and Sets
      • 15
        dict
      • 16
        Functions
      • 17
        Functions 2
      • 18
        Lambda and higher-order functions
      • 19
        Files

  • Digits after the decimal point

    It’s also possible to convert floating-point variables to integers by removing everything that comes after the decimal point. To do that we can write:
    num = 43243.6350207935
    res = int(num)
    print(res, num)
    This program would print 43243 43243.6350207935. So, the res is an integer, while num is a floating-point value.
     

    Challenge

    Given a floating-point number, remove the digits before the decimal point.
    Input
    Output
    875.2345
    0.2345
    57351.976
    0.976
     
    To check your solution you need to sign in
    Sign in to continue