Ahmed Asif
Ahmed Asif

Reputation: 1

why int() function not converting Number input into integer

import datetime

def random (start,stop):

    int(start)
    print(type(start))
    print(type(stop))
    print(type(num))
  
a = input("enter")
b = input("enter")
random(a,b)

I input to numbers and then that program should convert the first number (start) into integer but it didn't . Thing I did't get is why is it showing that start variable is a string I expected it to be an integer If I'm doing it wrong can you do correction thank you

Upvotes: 0

Views: 213

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

int() is not changing variable in-place, so you forgot to assign its output

start = int(start)

Upvotes: 2

Related Questions