On Wed, Feb 15, 2017 at 01:00:30PM -0500, Adam Howlett wrote: > Write an if-else statement that assigns 20 to the variable y if the > variable x is greater than 100. Otherwise, it should assign 0 to the > variable y. > > Is there an easy way to solve this problem?
Yes. What have you tried? Hint: here's a similar problem. "Write an if-else statement that assigns "Hello" to the variable q if the variable p is equal to 11. Otherwise it should assign "Goodbye" to the variable q." And here's the answer: if p == 11: q = "Hello" else: q = "Goodbye" Can you see the pattern? Can you follow that same pattern for your own question? (Hint: use > for "greater than".) -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor