Just some information, the change put your name here. My name is James Stinson T
ID: 3661838 • Letter: J
Question
Just some information, the change put your name here. My name is James Stinson
Title: Building a Simple Python Program
I. OBJECTIVES
This iLab demonstrates how to create a simple Python program on the Raspberry Pi. Proper procedures are used to program the following mathematical operation:
Number 1 + Number 2 = Results.
II. PROCEDURE
1. Boot up the Raspberry Pi (RPi).
2. Once the RPi boots, the desktop should look similar to Figure 1.
Figure 1—Raspberry Pi Desktop
3. Double-click on the IDLE icon (or highlight it, right-click, and then click Open). Be sure to use the IDLE icon, not the IDLE 3 icon (Figure 2).
Figure 2 —IDLE
4. The desktop should look similar to the following Figure 3.
Figure 3—IDLE Desktop
5. Click File, then New Window to open a window to create a program.
6. Enter the program below. Replace “’Put Your Name Here’” with your name.
Name = ‘Put Your Name Here’
Class= ‘ECT109’
Assignment = ‘Week 2 Lab 2’
#------------------------------------------------------------------
# Add two numbers
#------------------------------------------------------------------
print Name
print Class
print Assignment
print
a = input(‘Enter 1st Number: ‘)
b = input(‘Enter 2nd Number: ‘)
print ‘A+B= ‘,a+b
Table 1—iLab 2 Program
7. Click File, then Save to save your program. Save your file as FiLastNameLab2-2.py, where Fi is your first name initial and LastName is your last name.
8. To run your program, click Run, then click Run Module. You can also press the F5 key instead.
9. Fix any errors you may have. The approximate location of the first error will be highlighted.
10. Enter two numbers, one at a time as prompted. This Python program will add the two numbers, and display the results.
11. Exit all programs and return to the Raspberry Pi (RPi) desktop.
12. Open the Midori web browser (Figure 4).
Figure 4—Midori Browser Icon
Explanation / Answer
Name = 'James Stinson'
Class= 'ECT109'
Assignment = 'Week 2 Lab 2'
print Class
print Assignment
print
print 'Enter 1st Number: ',
a = int(raw_input())
print 'Enter 2nd Number: ',
b = int(raw_input())
print 'A+B= '+str(a+b)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.