Directions 1. Variables and literals • Read all the directions before you start coding! • You will create a program, in your IDE. that uses a variable. • Define a variable, something like varl. • Then assign the number 5 to your variable. if you need help with this refer to the Varlable page here in Canvas This should be the first line of your program and it should look something like this. Use the numeric value of 5 instead of O x-0 • Next write code to print the following statement on your screen: My favorite number is 5 • You should use the print function (printt "blah blah blah") to do this - Do not code the 5 as a literal S), it should be a number (so no quotes around i • You should use your variable. in a print statement, to print the value, such print"My favorite number is", umber) • Where number in the example is your variable name. • Using a variable in your print statement makes your statement more robust. If the value changes say to 42 then you don't have to change your print statement it will display the correct, new number. Try running your program multiple times changing your number each time Pay attention to what happens witho output - Name the source code fe yourName LAB2 1 py • Run the program - Capture the output and save it as an image file named yourName LAB2.otput.jpg - Continue with this code in problem 2 2. Variables and literals, Again Now, using vour proeram from #1 put double guotes around the variable in your print statement, In my example it would be number Save it asnew ile vouName LA2 2. pyand nun the proeram again Your code should look ke this priMy favorite number is "number • Capture the output and save it as an image fie named yourName LAB2 output2 jpg Do you see the differont between the two outputs? • Submit the py file and both jpg fes -n your submission box on Canvas, inchdeshort.colanation on why the two outputs are dfferent
Directions 1. Variables and literals • Read all the directions before you start coding! • You will create a program, in your IDE. that uses a variable. • Define a variable, something like varl. • Then assign the number 5 to your variable. if you need help with this refer to the Varlable page here in Canvas This should be the first line of your program and it should look something like this. Use the numeric value of 5 instead of O x-0 • Next write code to print the following statement on your screen: My favorite number is 5 • You should use the print function (printt "blah blah blah") to do this - Do not code the 5 as a literal S), it should be a number (so no quotes around i • You should use your variable. in a print statement, to print the value, such print"My favorite number is", umber) • Where number in the example is your variable name. • Using a variable in your print statement makes your statement more robust. If the value changes say to 42 then you don't have to change your print statement it will display the correct, new number. Try running your program multiple times changing your number each time Pay attention to what happens witho output - Name the source code fe yourName LAB2 1 py • Run the program - Capture the output and save it as an image file named yourName LAB2.otput.jpg - Continue with this code in problem 2 2. Variables and literals, Again Now, using vour proeram from #1 put double guotes around the variable in your print statement, In my example it would be number Save it asnew ile vouName LA2 2. pyand nun the proeram again Your code should look ke this priMy favorite number is "number • Capture the output and save it as an image fie named yourName LAB2 output2 jpg Do you see the differont between the two outputs? • Submit the py file and both jpg fes -n your submission box on Canvas, inchdeshort.colanation on why the two outputs are dfferent
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![- ONE source files: yourName_LAB2 py
- One image files: jpg. yourName LAB2 output.jpg.
NOTE: Separate the parts of the lab by outputting the question # and printing a line.
earch
Directions
1. Variables and literals
• Read all the directions before you start coding!
• You will create a program, in your IDE, that uses a variable.
- Define a variable, something like vari
- Then assign the number 5 to your variable. If you need help with this refer to the Variable paee here in Canvas This should be the first line of your program and it should look something like this. Use the numeric value of 5 instead of O
x=0
• Next write code to print the following statement on your screen My favorite number is 5
- You should use the print function (printt "blah blah blah") to do this.
• Do not code the 5 as a literal (51, it should be a number (so no quotes around it).
• You should use your variable. in a print statement, to print the value, such as:
printt"My favorite number is number)
• Where number in the eample is your variable name.
• Using a variable in your print statement makes your statement more robust. If the value changes say to 42 then you don't have to change your print statement it will display the, correct, new number. Try running your program multiple times changing your number each time. Pay attention to what happens with o
ndino
- Name the source code file yourName LAB2_1 py.
- Run the program.
- Capture the output and save it as an image file named yourName LAB2 output.jpg
- Continue with this code in problem 2
2. Variables and literals, Again
- Now. using your program from 1 put double quotes around the variable in your print statement, In my example it would be number. Save it as a new file, vouName LAB2 2 py.and nun the program again. Your code should looklike this
prietMy favorite number is"."number
- Capture the output and save it as an image fle named yourName LAB2 output2.jpe Do you see the different between the two outputs?
- Submit the py file and both jpg files
-In your submission box on Canvas, include a short oplanation on why the two outputs are dfferent
3. Average of values
-When we want to find the average of a set of numbers we add tthe values up and then divide the sum by the number of values
Create 5 variables that stores the following values, one in each variable: 28, 32, 37,24, and 33. f you need help with this refer to the Variable page herein Canvas
-Your proggram should next calculate the sum of these five variables and store the result in a separate variable named sum
-Next the program shoulld divide the sum variable by 5 the number of values to get the average. You should store the average in a newvariable, like something called results
- Disolay, by using the print function, the average on the screen
Tip: add the variables together not the actually numbers. Something like
mySuma+bc.
- Name the source code file yourName HW2.py.
- Compile and run the program. Capture the output console and save it as an image file named yourName LAB2 output.jpg
- Submit 1.oy files and 1mage fles through Canvas
2 64'F Mostly clear
Ps
P Type here to search](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa28e6c6b-5aa7-434a-8d46-6dcbce6e149c%2F8ee21302-b513-4310-b24d-88f0d40eaf11%2Fl8wq8ux_processed.jpeg&w=3840&q=75)
Transcribed Image Text:- ONE source files: yourName_LAB2 py
- One image files: jpg. yourName LAB2 output.jpg.
NOTE: Separate the parts of the lab by outputting the question # and printing a line.
earch
Directions
1. Variables and literals
• Read all the directions before you start coding!
• You will create a program, in your IDE, that uses a variable.
- Define a variable, something like vari
- Then assign the number 5 to your variable. If you need help with this refer to the Variable paee here in Canvas This should be the first line of your program and it should look something like this. Use the numeric value of 5 instead of O
x=0
• Next write code to print the following statement on your screen My favorite number is 5
- You should use the print function (printt "blah blah blah") to do this.
• Do not code the 5 as a literal (51, it should be a number (so no quotes around it).
• You should use your variable. in a print statement, to print the value, such as:
printt"My favorite number is number)
• Where number in the eample is your variable name.
• Using a variable in your print statement makes your statement more robust. If the value changes say to 42 then you don't have to change your print statement it will display the, correct, new number. Try running your program multiple times changing your number each time. Pay attention to what happens with o
ndino
- Name the source code file yourName LAB2_1 py.
- Run the program.
- Capture the output and save it as an image file named yourName LAB2 output.jpg
- Continue with this code in problem 2
2. Variables and literals, Again
- Now. using your program from 1 put double quotes around the variable in your print statement, In my example it would be number. Save it as a new file, vouName LAB2 2 py.and nun the program again. Your code should looklike this
prietMy favorite number is"."number
- Capture the output and save it as an image fle named yourName LAB2 output2.jpe Do you see the different between the two outputs?
- Submit the py file and both jpg files
-In your submission box on Canvas, include a short oplanation on why the two outputs are dfferent
3. Average of values
-When we want to find the average of a set of numbers we add tthe values up and then divide the sum by the number of values
Create 5 variables that stores the following values, one in each variable: 28, 32, 37,24, and 33. f you need help with this refer to the Variable page herein Canvas
-Your proggram should next calculate the sum of these five variables and store the result in a separate variable named sum
-Next the program shoulld divide the sum variable by 5 the number of values to get the average. You should store the average in a newvariable, like something called results
- Disolay, by using the print function, the average on the screen
Tip: add the variables together not the actually numbers. Something like
mySuma+bc.
- Name the source code file yourName HW2.py.
- Compile and run the program. Capture the output console and save it as an image file named yourName LAB2 output.jpg
- Submit 1.oy files and 1mage fles through Canvas
2 64'F Mostly clear
Ps
P Type here to search
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 6 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education