0

Im new to python, and im truly confused, please help

boole = False
alpha = input()
int(alpha)
if alpha == 2:
    boole = True

print(boole)

it outputs False, when I want it to output true

1
  • 3
    did you mean to do alpha=int(alpha) ? Commented May 21, 2020 at 3:24

3 Answers 3

1

Your int(alpha) isn't doing anything. You need to assign it to a variable. Or rather, a cleaner approach is to wrap the input() call with it.

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

Comments

0

You're not saving the int(alpha) in alpha, so the variable is still holding the value of the input as a String value.

change that line:

alpha = int(alpha)

Comments

0

You should call input() first and imagine that it is the thing user inputted. Then make the input an integer by using this: alpha = int(input())

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.