Sep-03-2019, 06:10 PM
Hey guys, I'd appreciate some help on a homework question. It's very entry level and not too hard but due to my lack of any knowledge using python and my teacher poorly explaining anything, I just can't figure it out. Thank you!
##1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
## if the variable x is greater than 100.
## Solution:
##if x > 100:
## y = 20
## z = 40
####1.1. Further extension of 1:
##Using input('Enter integer x: ') prompt:
## Write an if statement that prints and calculates this line:
## distance from x to 100: x - 100 and distance from x to 200: 200 - x
## if the variable x is greater than 100 and less than 200. If not 100<x<200
## do not print anything.
## Write your code here: (start with input)
##1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
## if the variable x is greater than 100.
## Solution:
##if x > 100:
## y = 20
## z = 40
####1.1. Further extension of 1:
##Using input('Enter integer x: ') prompt:
## Write an if statement that prints and calculates this line:
## distance from x to 100: x - 100 and distance from x to 200: 200 - x
## if the variable x is greater than 100 and less than 200. If not 100<x<200
## do not print anything.
## Write your code here: (start with input)