0
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

3
  • also where you initialised num i don't see anywhere.. Commented Dec 10, 2022 at 7:49
  • Since this is test code for stackoverflow, get rid of the prompts for input and hard code a call to random. Include the output you get and the output you want. That makes it easier to debug and include code in answers. Commented Dec 10, 2022 at 8:01
  • Did you notice the NameError exception that was raised when you ran this? Commented Dec 10, 2022 at 8:21

1 Answer 1

2

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

start = int(start)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.