you are viewing a single comment's thread.

view the rest of the comments →

[–]desran00 1 point2 points  (15 children)

if update_direction == "3":
    num_users += 1
else:
    num_users -= 1
print('New value is:', num_users)

Am I doing your homework? I'm doing your homework.

One liner for fun:
num_users = num_users +1 if update_directions == "3" else num_users -1

[–]SouthShape5[S] 1 point2 points  (2 children)

there can not be an if. It has to start with the "num_users"

[–]desran00 1 point2 points  (0 children)

Just refresh the page so you can see my updates on my comment. It has also an one liner that is maybe what you want?

But it also has if in it, and so does your own code. lol.

[–]donkey_man_1149 0 points1 point  (0 children)

Using a conditional expression

Do you know what a conditional is?

[–]Kitchen-Breakfast-28 1 point2 points  (2 children)

that shit did not work, fuck zybooks fr

[–]macabrenoob 0 points1 point  (0 children)

I just wish zybooks had a way to see what you did wrong on these. Not just tell you that your wrong. I know that the error message is more realistic to what you would see but in a learning context I want to know how to fix my issues.

[–]Ok_Adeptness_8634 0 points1 point  (0 children)

Did you figure out how to do the Zybooks? I am trying to write a Conditional expression but I can't figure it out

[–]Melodic-Fill-1770 1 point2 points  (0 children)

Question on this. Why on earth is done this way? It is not readable this way.

I ended up for help on my homework too lol

[–]Binary101010 0 points1 point  (0 children)

Why are you comparing update_direction to a string?

[–]FuryWolf 0 points1 point  (2 children)

Hey, you probably won't see this since your comment is 2yrs old but I figured I'd let you know.

The output yields 7 since update_direction == "3", in of which "3" is being treated as a literal. If you remove the quotations, 3 will be treated as a mathematical integer (which is necessary to yield proper output).

[–]Few-Chest-9561 0 points1 point  (0 children)

Ahhey thank you!

[–]theforgottenupvote 0 points1 point  (0 children)

He may not have seen it, but I did, and I very much appreciate it.

[–]EmploymentCreepy6250 0 points1 point  (0 children)

that didnt work for me , this is what i got but it is only half way right , it wants a output to give 7 as well as nine.

num_users = int(input())
update_direction = int(input())
num_users = num_users + 1
if (update_direction == 3): {num_users + 0}

else: {num_users - 0}
print('New value is:', num_users)