On Sat, 23 Sep 2017 03:01 pm, Bill wrote:
> if (20 - 10) > 15 :
> print("true")
> else:
> print("false");
print(20 - 10 > 15)
will do the job.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
--
https://mail.python.or
Chris Warrick wrote:
This outputs "False is false", because you used the variable in your
expression. You can just do this:
print("s is", s)
This will print "s is False".
Ah, good point! But I do like "self-documenting" output (so I don't
mind seeing s)---if you had 5 or more statements a
On 23 September 2017 at 06:46, Cai Gengyang wrote:
> Output :
>
> ('bool_one = ', False)
> ('bool_two = ', False)
> ('bool_three = ', False)
> ('bool_four = ', True)
> ('bool_five = ', False)
You’re using Python 2 with Python 3-style print statements. To make it
look good, start your code with:
Steve D'Aprano wrote:
On Sat, 23 Sep 2017 03:01 pm, Bill wrote:
s='(20 - 10) > 15'
b=(20 - 10) > 15
print(s, " is ", ("true" if b else "false") ); ## inside parentheses
may be removed.
I am new to Python. Maybe someone here is familiar with an elegant way
to get the the value of b directly
On Sat, 23 Sep 2017 03:01 pm, Bill wrote:
> s='(20 - 10) > 15'
> b=(20 - 10) > 15
> print(s, " is ", ("true" if b else "false") ); ## inside parentheses
> may be removed.
>
> I am new to Python. Maybe someone here is familiar with an elegant way
> to get the the value of b directly from the s
On Friday, September 22, 2017 at 11:46:59 PM UTC-5, Cai Gengyang wrote:
> Input :
>
> # Assign True or False as appropriate on the lines below!
>
> # (20 - 10) > 15
> bool_one = False# We did this one for you!
>
> # (10 + 17) == 3**16
> # Remember that ** can be read as 'to the power of'. 3*
Bill wrote:
Cai Gengyang wrote:
Hey guys, I'm testing this on CodeAcademy, but I cant get the program
to output a result even after pressing the run button. Just wanted to
check if my logic is correct. Thanks alot
Your answers appear correct, but you could write Python statements to
test them
Cai Gengyang wrote:
Hey guys, I'm testing this on CodeAcademy, but I cant get the program to output
a result even after pressing the run button. Just wanted to check if my logic
is correct. Thanks alot
Your answers appear correct, but you could write Python statements to
test them (or any you
Input :
# Assign True or False as appropriate on the lines below!
# (20 - 10) > 15
bool_one = False# We did this one for you!
# (10 + 17) == 3**16
# Remember that ** can be read as 'to the power of'. 3**16 is about 43 million.
bool_two = False
# 1**2 <= -1
bool_three = False
# 40 * 4 >= -4
You have a lot of assignment statements, but nothing that produces output. Try
adding statements like this at appropriate places...
print ("bool_one = ", bool_one)
--
https://mail.python.org/mailman/listinfo/python-list
Hey guys, I'm testing this on CodeAcademy, but I cant get the program to output
a result even after pressing the run button. Just wanted to check if my logic
is correct. Thanks alot
# Assign True or False as appropriate on the lines below!
# (20 - 10) > 15
bool_one = False# We did this one
11 matches
Mail list logo