Why doesn't my code work

Why doesn't my code work

Attached: Screenshot_20180615-142123~2.png (1440x956, 104K)

Other urls found in this thread:

docs.python.org/3/library/constants.html
docs.python.org/3/library/functions.html#input
docs.python.org/3/library/stdtypes.html#comparisons
youtube.com/watch?v=5wx3EWjOqnc
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
twitter.com/SFWRedditGifs

Because you're comparing the user input string to the boolean type

sage

Because it's written in python

boolean != string input

Because you didn't write it in Perl

Because you're a dumb tard.

>cd kode
>cd ..
>g++ kode.cpp
>cd..
>cd ..
>mkdir kode
>cdkode
>cd kode

This
true ≠ "true"
I think you can input a 1 or a 0 and have it work but I don't know Python.

How to write cancer in python

Is this bait?
First of all please change your font, to normal white background. Second, you need to learn what Strings are. You are taking user input as a String, then comparing it to a boolean. Second, look at your IF and ELSEIF statement. If the boolean == true, then by default the other statements has to be false, so you dont need the second ELSEIF

Attached: 1452755022140.png (633x758, 696K)

>Python 3
Probably a space.

this

I prefer Perl6 over Python. Even though Python is cleaner it is a bad habit to write conditionals without enscapulation.

Debuging something by looking for an additional space is not good design even tho it looks slick. I easily get python mixed up with visualbasic or some other scripting language.

Attached: 1529067064368-g.jpg (700x701, 151K)

I don’t know Python so that code doesn’t make sense to me.
Where is “boolean” defined and if it’s a type, what is the variable it qualifies?
Also spacing is fucked but you have no choice I’m told.

These are all answered by googling for 5 seconds.

sage

[1]: docs.python.org/3/library/constants.html
[2]: docs.python.org/3/library/functions.html#input
[3]: docs.python.org/3/library/stdtypes.html#comparisons

Even though Python doesn't require it, this is a good reason why you should annotate the functions you use with the data types they consume and output -- particularly if you're a nooby programmer.

input() makes the input into a string.[2] A String and a Boolean will never compare as equal.[3] True and False are Boolean values.[1] Hence, it doesn't work.

Watch and learn Bud.
youtube.com/watch?v=5wx3EWjOqnc
Search for "programming data types".

use elif not else if

>Why doesn't my code work
maybe it's your nationality.
have you considered sudoku?

that code is outright retarded

The problem comes the "is_true" function. Let me fix it for you :

def is_true( boolean ):
if boolean == True:
return is_true( True )
elif boolean == False:
return is_true( False )

No need to thank me!

8/10 real pajeets make worse

Attached: 14980448470530.jpg (600x644, 56K)

def isTrue(Boolean):
if Boolean == 'true':
return 'you typed true'
else:
return 'you typed false'
user_input = input("type true or false")
print(isTrue(user_input))

Attached: 1519871654843.png (813x444, 55K)

forgot chmod 700

Interesting. For a C programmer, Python seems interesting. If it wasn't for the obligatory spacing requirements I would consider picking it up.

how do you know C and still not know the difference between a string and a boolean?

Attached: 1487614720518.jpg (702x672, 130K)

I answered before watching the video thinking it was about how Python deals with types. I thought Python was a descendent of Pascal which is strongly typed.

OP here. The post was total bait. Sorry

ye the spacing is fucking lame. its the only reason i havent bothered learning it desu. not that it really matters anymore. lots of good resources on ML for c++ now

That's the problem with learning with Python op, you can be lazy with your classes and just let it pick the data type it wants.

>all the autists so thirsty to answer questions they don't notice he's making a literal boolean check function

Really strong bait

Attached: 726d58a7449d385f9376c05dcdfe6f0cca947384.gif (240x200, 2.59M)

You forgot the in-between state "Frue". What happens when a user types neither true nor false?

Why doesn't my code work

Attached: imgur-2018_06_16-03:56:46.png (557x198, 12K)

Idiot

Nigga I cant even get this shit to work

Attached: reboot-select-proper-boot-device-rcm992x0-min.jpg (570x361, 12K)

You comparing boolean to strings nigga

nope ._.

Attached: imgur-2018_06_16-04:04:52.png (615x203, 12K)

Dang well sorry user I'm pretty drunk right now but I would reference how to use tertiary operators, they might be formatted differently.

Boolean is an object, you dumb cunt.

isOdd all over again

Attached: 1526510467971.jpg (600x600, 57K)

I am of not seeing issue in this program my good friend. I compiled it with few modification in Javac compiler and I seem to have working application :-)

>Perl6
We all like to dream user

>code with karlie
>xdddddd
and thats why I hate feminist

if you're not comparing the object isTrue to anything, as long as it's defined, it will be equivalent to true

try null ? true : false

How the fuck can you compare a string that the user inputs, to A FUCKING BOOLEAN?! Dumb pythonists

oh here's your issue! you forgot to make more functions that do fucking nothing!
def return_if_string(inputt)
if type(inputt) is str:
return input
elif type(inputt) is bool:
return False
elif type(inputt) is list:
return False
else:
return False

def is_true_string(inputt):
if return_if_string(inputt) != False:
if type(inputt) is str:
if type(inputt) != dict:
if inputt != False:
return (inputt == "True")

hehehe

just select the proper boot device or insert boot media in selected boot device, user.

can your ead?

>your ead
you read FUCK

>#include

Really fucking late response, but in effect, your ternary statement is comparing an object like said. It will always evaluate true because the value of that object is not null/0. Try:
const isRealTrue = Boolean(false);
isRealTrue ? "true" : false";
//Evaluates to "true".


Also, maybe read MDN sometimes, this is something that you can Botnet in a minute.
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean

He could if he converted the user input to an integer, but he needs to learn to not be redundant first.

>is this bait

because WHY THE FUCK do you need that is_true function you inbred monkey

'False' isn't False

'True' should be True tho