Python | User Input Function

python user input
python user input



Python | User Input Function 


the built in input() function is used for tacking the input from the user by add value from keyboard press and store into variable name


Example

        var = input('enter value number: ')


Output

    enter value number :                 # User can add value from here and press enter  



Using input Function Add Two Numbers 

    var1 = int(input('enter first number: '))
    var2 = int(input('enter second number: '))


    sum = var1 + var2 ;

    # show the  output

    print(“sum of var1 and var2 is ",sum)


Output

    enter first number: 10
    enter second number: 20
    sum of var1 and var2 is  30


                

Post a Comment (0)
Previous Post Next Post