# Homework Solution: PYTHON…

PYTHON A variable like num can store a value like an integer. Extend the given program to print num values as indicated. (1) Output the user's input as shown. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.
```Enter integer:
4
You entered: 4
```
(2) Add to your program to output also the input doubled and squared. (2 pts)
```Enter integer:
4
You entered: 4
4 doubled is 8
And 4 squared is 16!
```
(3) Update to get a second user input into a variable called num2. Output sum and product of num and num2. (2 pts)
```Enter integer:
4
You entered: 4
4 doubled is 8
And 4 squared is 16!
Enter another integer:
5
4 + 5 is 9
4 * 5 is 20
```
What I have so far: num = int(input('Enter integer:n')) print(num) print("You entered:", num) print(num, "doubled is", num*2) print("And", num, "squared is", num**2, "!")

num = int(input('Enter integer:n'))

PYTHON

A mutable approve num can hoard a esteem approve an integer. Extend the abandoned program to sculpture num esteems as indicated.

(1) Output the user’s input as shown. (2 pts)

Note: This zyLab outputs a newcontinuity behind each user-input ready. For retirement in the examples beneath, the user’s input esteem is shown on the instant continuity, excluding such esteems don’t really tally as output when the program runs.

```Enter integer:
4
You entered: 4
```

(2) Add to your program to output besides the input doubled and squared. (2 pts)

```Enter integer:
4
You entered: 4
4 doubled is 8
And 4 squared is 16!
```

(3) Update to attain a promote user input into a mutable named num2. Output mix and consequence of num and num2. (2 pts)

```Enter integer:
4
You entered: 4
4 doubled is 8
And 4 squared is 16!
Enter another integer:
5
4 + 5 is 9
4 * 5 is 20
```

What I possess so far:

num = int(input(‘Enter integer:n’))
print(num)
print(“You entered:”, num)
print(num, “doubled is”, num*2)
print(“And”, num, “squared is”, num**2, “!”)

## Expert Tally

num = int(input(‘Enter integer:n’))
print(“You entered:”, num)
print(num, “doubled is”, num*2)
print(“And”, num, “squared is”, num**2, “!”)
num2 = int(input(‘Enter another integer:n’))
print(num,”+”,num2,” is “,num+num2)
print(num,”*”,num2,” is “,num*num2)

OUTPUT: