Question: number input ('Please enter a number: .) If Statements If statements allow you to run different code based on conditions that you set. The simplest

 number input ('Please enter a number: .) If Statements If statements

number input ('Please enter a number: .) If Statements If statements allow you to run different code based on conditions that you set. The simplest if statement looks something like this: if condition: code code. If condition evaluates to True, code (which could be many lines of statements) will be run. If condition evaluates to False, then Python will skip to the next line of code after the if statement. For example, this code will print 'Monty', but not 'python': y=0 if x > 1: print('Monty) if y> 1: print 'Python) We want you to prompt the user to enter an integer, and then print the absolute value of that integer You'll need to convert the string you get from input into an integer, as in the previous question. If the user enters a negative number, you need to make it positive (that's what the if statement is for!)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!