Question
2. (5 points) Write Python expressions for each of the following: a. Determine if n, an integer, is between 35 and 50 inclusively. b. Determine
2. (5 points) Write Python expressions for each of the following:
a. Determine if n, an integer, is between 35 and 50 inclusively.
b. Determine if n, an integer, is greater than 80, but less than or
equal to 100.
c. Determine if n, an integer, is odd.
d. Determine if n, an integer, is divisible by 7.
e. Determine if n, an integer, is divisible by 4 or 3, but not both.
3. (5 points) If p is true, q is false ,r is false, x is 5, y is -3, and z is 0.
What is the value of each of the following expressions:
a. not r and (p or q) and z > x
b. not q and p or x != y and r
c. not (r and p) or (z < y)
d. not (x < z and y != 0) and r
e. not p and not(not q and r) or not(x < y)
4. (5 points)Write an algorithm(or pseudocode or flowchart) for :
Ask the user to enter their year of their birth. Validate the year, to verify it is between 1920 and 2017 -- and display error message if its not valid. Print the users current age based on the year of their birth. Repeat this until the user wants to quit.
5. (5 points)Convert the above pseudocode into a python program.
Screenshot must be included.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started