Section 1.12 LAB - IT 140_ Introduction to Scripting _ zyBooks

pdf

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

140 - X625

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

1

Report

Uploaded by DeaconCaterpillar4154

1.12 LAB: Warm up: Basic output with variables This zyLab activity prepares a student for a full programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment, and are well-suited for an in-person scheduled lab meeting or as self-practice. A variable like user_num can store a value like an integer. Extend the given program as indicated. 1. Output the user's input. (2 pts) 2. Output the input squared and cubed. Hint: Compute squared as user_num * user_num. (2 pts) 3. Get a second user input into user_num2, and output the sum and product. (1 pt) 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 4 squared is 16 And 4 cubed is 64 !! Enter another integer: 5 4 + 5 is 9 4 * 5 is 20 553398.3976864.qx3zqy7 LAB ACTIVITY 1.12.1: LAB: Warm up: Basic output with variables 0 / 5 Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the ±rst box, then click Run program and observe the program's output in the second box. Enter program input (optional) 8 Input (from above) main.py (Your program) Output (shown below) Program output displayed here Coding trail of your work 3/9 S ----- min:4 main.py Load default template... user_num = int ( input ( 'Enter integer:\n' )) # Type your code here print 'you entered, user_num' print 'user_num * usernum = user_numsquared' Develop mode Submit mode Run program What is this? Feedback? 1 2 3 4 5 6
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help