CTS1133C-M03Prt01-NETLAB15
.pdf
keyboard_arrow_up
School
Florida State College at Jacksonville *
*We aren’t endorsed by this school
Course
2092
Subject
Computer Science
Date
Jun 24, 2024
Type
Pages
12
Uploaded by ChefFreedom10543
196
Complete A+ Guide to IT Hardware and Software
Lab 15.8 Introduction to Python Scripting
Objective: To create and run Python scripts using IDLE
Parts: Windows computer with access to the internet and rights to download and install free software
Procedure: Complete the following steps and answer the accompanying questions
1.
Power on the computer and log on. Open a web browser.
2.
In the browser, go to https://www.python.org. Click Downloads
> Download Python 3.10.4
. Save the
file python-3.10.4-amd64.exe
to a place on the computer where you can find it.
LAB 15:
Introduction to Scripting Labs 197
LAB
15
Note:
At the time of this writing, Python 3.10.4 was the latest version. If that has changed, you can download a later version. However, to do this lab, you must have a version of Python 3 installed (
not
Python 2!).
The executable file that you downloaded installs Python on your computer. This will allow you to create programs in the Python language, using the integrated development environment (IDE) named IDLE. (Note: IDE is a generic term for a program used by a language to write programs, and IDLE is the name of the IDE used here to write Python programs.)
3. Run the executable file and follow the prompts. Accept all the default options. If your installation is successful, you should see a verification similar to the one shown in Lab Figure 15.4.
LAB FIGURE 15.4 Successful installation of Python
4. From Windows Start, expand the Python 3.10 folder, if necessary, and click on IDLE (Python 3.10 64-bit), as shown in Lab Figure 15.5.
LAB FIGURE 15.5 IDLE (Python 3.10 64-bit) in the Start menu
198
Complete A+ Guide to IT Hardware and Software
5. You should see the IDLE Shell 3.10.4 window. This is also called the Python Shell. Make it active by clicking anywhere in its blank area. The cursor should be blinking to the right of the three chevrons: >>>
. Press ®
two times, and you should see two more rows of chevrons. This means that Py-
thon is working and waiting for you to do something.
6. In the Python Shell window, type the following:
print("I got it to work!")
Press ®
, and you should see a screen like the one shown in Lab Figure 15.6.
LAB FIGURE 15.6 Working in the Python IDLE shell
7. To prepare for your work, create a folder called PythonTest
. Make sure you know where this folder is located.
8. The Python Shell window is where you see a script run. To create a script, you need to work in the Python editor. From the menu within the Python Shell window, select File
> New File
to open the Python editor.
Type the following into the editor:
# display a greeting and generate a password
# get input from the user
first_name = input("First name: ")
last_name = input("Last name: ")
id_number = input("Enter your school ID number: ")
# create strings
name = first_name + " " + last_name
temp_password = first_name + "*" + id_number
# display the results
print("Welcome " + name + "!")
print("Your temporary password is: " + temp_password)
Be sure to type this code exactly as shown. In Python, indents, spaces, and line spacing are very important:
>
In this program, any line that begins with a hash symbol (
#
) is a comment and will be ignored by the computer when the program runs.
>
The following are the variable names in this script: first_name
, last_name
, id_number
, name
, and temp_password
. The value on the right side of the equals sign is the value stored in the variable on the left side.
LAB 15:
Introduction to Scripting Labs 199
LAB
15
>
In the line first_name = input("First name: ")
, the variable is first_name
. The word input
is a Python function that tells the computer to put a prompt on the screen. The text of the prompt is whatever is enclosed in quotes inside the parentheses. In this case, the text First name:
is displayed. When the user enters their name, that value is stored in the variable first_name
.
>
The name
variable joins the values of two variables and adds a space between those values because of the space within quotes (
"
"
).
>
The print()
command tells the computer to display something on the screen. It can be text, the value of a variable, or a combination of text and variables.
9. Save your program with the filename python1
xxx
.py
(where xxx
is your initials) inside your PythonTest
folder by going to the File
tab and selecting Save As
.
10. Now you can run your program. Go to the Run
tab at the top of the Python editor screen, as shown in Lab Figure 15.7, and click on Run Module
. The program should open in the Python shell and prompt you for your first name.
LAB FIGURE 15.7 The Run
tab in the Python IDLE editor
If you get an error, go back to the editor and compare your code with the code given above. Fix any errors you find, save the changes, and try again.
11. Nothing happens until you enter something. Enter Jackie
for the first name and enter Cho
for the last name. Enter 123456
for the school ID number. You should see the results in the Python shell, as shown in Lab Figure 15.8.
LAB FIGURE 15.8 Results of the first Python script
Did the script work? [ Yes | No ] If the script did not work, troubleshoot and edit your code as necessary until it does.
Instructor initials: _____________
200
Complete A+ Guide to IT Hardware and Software
12. Create a new Python program. Name this new file python2
xxx
.py (where xxx
is your initials). This new program will use a decision structure to decide whether a user is eligible for a 20%, 10%, or 0% discount on a purchase. In this program, the user will enter the cost of a purchase. If the purchase value is over $100.00, the discount is 20%. If the purchase value is $50.00 to $99.99, the discount is 10%. Anything under $50.00 is not eligible for a discount. The code for this program is as follows:
# prompt user for cost of purchase
cost = float(input("How much is your purchase? $ "))
# check for discount amount
if cost >= 100:
discount = cost * .20
percent = "20%"
elif cost >= 50:
discount = cost * .10
percent = "10%"
else:
discount = 0
percent = "0%"
# display the results
cost = cost - discount
print("You have received a " , percent, " discount")
print("Your final cost is $ ", cost)
13. Run the program at least three times to check that all the discount options (0%, 10%, or 20%) work. You can enter any numbers you want, but here are some suggestions for input:
105
87
50
34
If you enter 87
at the prompt, you should see the results shown in Lab Figure 15.9.
You might notice that there are some things that could be improved in this program:
>
Try entering a negative number. The program will still run, but it makes no sense to have a negative value as an input. You can fix this later as an On Your Own exercise.
>
The output shows a dollar amount but has only one decimal place where you would expect two. There are ways to deal with this issue, but they require more advanced coding, so for now, this is fine.
>
Each time you want to enter a new value, you must run the program again. By using a loop, you can allow the user to enter as many values as desired. You will add this functionality in the next step.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Python Automation Script:
write a python automation script that scrape gold rate from website automatically:
get the latest(today's) gold rate in delhi from the website and change from previous day,
and print the result on the screen.
arrow_forward
ment basic file input/output methods
To verify, test, and debug any errors in the code
Module learning outcomes assessed by this coursework:
On successful completion of this assignment, students will be expected, at threshold level, to be able
LO # 5: Software development environments (editor, interpreter, debugger), and programmi
using Python programming language.
Task:
Students are required to
create
a Python program that performs customized Caesa
encryption/decryption, as follows:
A- The program should have a main menu, through which the user can choose whether he wants
to encrypt a text or decrypt it.
B- If the user chose to encrypt plaintext, he will be asked to enter his ID, which is also the name
of the input file (i.e. if student ID is 199999, then the input file name should be 199999.txt).
The user should not enter the file extension (i.e. .txt), instead, the program should append
the extension to the ID automatically.
C- The input file must contain the following information:…
arrow_forward
Python supports the following file processing modes: read-only, write-only, and read-write.
arrow_forward
There are three main types of interface
which enable us to interact with a
computer.
a) Identify the type of interface shown below
b) Explain an advantage and disadvantage of
using this type of interface
C:\WINDOWSystem32\cmd.exe
Microsoft Windows XP [Version 5.1.2600)
(C) Copyright 1985-2881 Microsoft Corp.
CINDocuments and Settings>
c) Joe is the IT manager of a medium sized
eCommerce company, Acme Ltd.
There are several hundred employees
working for the company's Head office. The
Operating System they currently use is
Microsoft Windows. Joe is keen to switch to
a Linux Operating System as he thinks it will
save money.
Is Joe correct? What are some other issues
he should consider before switching?
arrow_forward
please I need a python programme to help me with my question to discuss payment deatils please leave your contact info below in answer or comment
arrow_forward
Write a program that accepts two four-digit binary numbers, converts them to decimal values, adds them together, and prints both the decimal values and the result of the addition.
Requirements:
Functionality. (80pts)
No Syntax Errors. (80pts*)
*Code that cannot be compiled due to syntax errors is nonfunctional code and will receive no points for this entire section.
Clear and Easy-To-Use Interface. (10pts)
Users should easily understand what the program does and how to use it.
Users should be prompted for input and should be able to enter data easily.
Users should be presented with output after major functions, operations, or calculations.
All the above must apply for full credit.
Users must be able to enter a 4-bit binary number in some way. (10pts)
No error checking is needed here and you may assume that users will only enter 0’s and 1’s, and they will only enter 4 bits.
Binary to Decimal Conversion (50pts)
You may assume that users will only give numbers that add up to…
arrow_forward
Python Automation Script:
write a python automation script that scrape a website:
get the latest(today's) gold rate in delhi from the website and change from previous day,
and print the result on the screen.
arrow_forward
Question
• Computer Engineering lab
You are assigned three tasks for this weekend, first
you have to develop a script in F95 programming
language to print the statement "Hikaru Nakamura
is a top chess player" 10 times to the output
window.
arrow_forward
Question - 3) Using Visual studio demonstrate types of Errors in C#:
(Submission Instruction: Take the screenshots of those errors and paste in the
MS Word file and explain the cause of errors and how you can fix them)
You may use the same project which you used in Question to show how can errors
may occur and how you fix them.
Types of errors you should demonstrate are :
Syntax errors
Runtime Errors
Logical Errors
[
3| Page
arrow_forward
PYTHON PROGRAMMING
arrow_forward
python automation, how do you know which is relative xpath or absolute xpath? If your relative xpath doesn't work, what to check?
arrow_forward
C LANGUAGE ONLY
Limited Shell
Through this program, you will learn to do the following:
Work with processes using fork, pipe, wait, dup2, and the exec system calls.
Additional practice with a Makefile with an all target
Work with the different address spaces
The main idea of this program is to write a limited function shell that only runs a few programs from a menu.
Perform "four" small programs to start with followed by the menu program called newshell.
Part 5. newshell
Write a parent program similar to myshell.c but called newshell which will allow the user to choose from a menu of options.
Usage would be: newshell
1 letters2 numbers3 firstname4 userinput5 letters > filename (letters redirected to a file)6 letters | userinput (letters piped to userinput)7 firstname| userinput (names piped to userinput)8 exit (your program should end by leaving the infinite loop.)
These programs should be completed with the process commands fork, pipe, wait, dup2, and the 6 exec…
arrow_forward
Don’t copy / paste from google must be original app
Your task is to design, develop a application basic Your program must be original, user
friendly and efficient.
Requirements:
Your program must be done in C++ or Ps.JS;
arrow_forward
Give proper explanation and don't copy from any websites
arrow_forward
History
Bookmarks
Window Help
A augie.instructure.com
Of the choices, this represents the language that is most difficult for a human to read.
assembly
high-level
machine
No answer text provided.
0.5 points
An
is a reusable software component and can take the form of a date, time, audio, video, etc.
type your answer...
0.5 points
Which of the following is NOT an example of a Python Standard Library module?
math
sys
json
randomize
tv
4
MacBook Pro
Q Search or enter website name
O000
arrow_forward
San Pedro Belize Express has become the leading mode of transportation to Caye Caulker
and San Pedro and neighboring islands. The changes in travel restrictions and tracking due to
the Covid 19 has placed a demand on the company to keep better records of their
passengers.
The Company is wanting a secure ticketing system capable of keeping important and relevant
information from their customers
Create a python program that allows only authorized user to log into the system for ticketing
transactions and customer information queries
The program will accept names, phone number and SSID from User, Destination before
printing tickets granting them access to board the boat
The program should be able to print all customer and destination and price paid for
tickets(eacher customer records should be printed on different line in a list format/ table
format)
Destination,
San Pedro,
Name,
ID#
Fee
John Doe
2133
25
Billy Jean
Ricky Martin Caye Chapel 1322
Caye Caulker 3345
30
18.50
The program will…
arrow_forward
What makes a source code file, an object code file, and an executable file (or programme) different? computer science
arrow_forward
Java programming please type the code thanks
This problem set will test your knowledge of System I/O, variable assignment, flow control, and loops. Your task is to create several different java classes (.java files) that will produce a specific output based on the user input. All input will be given to you either as a command-line argument or typed in from the keyboard.
Below you will find directions for each class you need to create. Please make sure that the class name and java file name match the name
ReverseInput
This application accepts user input from the console and then prints the reverse of the user input to the console. The last string that this program should print is the reverse user input.
WaitForCorrectWord
This application will be passed a single word in its command-line argument array. It will expect the user to type in this word. Then it should wait for the user to type the word in. If the user types in a word that does not match the word it was initially given, the…
arrow_forward
Java programming please type the code thanks
This problem set will test your knowledge of System I/O, variable assignment, flow control, and loops. Your task is to create several different java classes (.java files) that will produce a specific output based on the user input. All input will be given to you either as a command-line argument or typed in from the keyboard.
Below you will find directions for each class you need to create. Please make sure that the class name and java file name match the name
SumRange
This script will be given a runtime argument of 3 values within it. The first user value will always be less than the second value. This script should calculate the sum of every nth whole number between the first and second value. The term "nth" denotes the step size which will be equal to the 3rd value. Example if the third value is 2 then it will add every other or every second value. If the third value is 4 it will add every 4th value. In the end the application should…
arrow_forward
C# programming
• Create a text file outside of C#• Read each record (name) from the file and• Append today’s date to a line from the text file and write to asecondary text file
arrow_forward
Java program Classes and object
arrow_forward
Computer Basics Assignment
Q1: Define the following:
| 1- File
| 2- System unit 3- Spyware
4- Hard disk
5- RAM
arrow_forward
Python strings and hardware/system setup/control-are they related?
Have you configured devices or systems using CLI or GUI? Describe?
arrow_forward
C#
DO NOT COPY FROM OTHER WEBSITES
Code with comments and output screenshot is must for an Upvote. Thank you!!!!
arrow_forward
67.
Which is a valid program to access the internet:
a) Access
b) Front Page
c) Netscape
d) None of The Above
arrow_forward
what do you call a command line interpreter which lets you interact with your os and execute python
arrow_forward
* defined as programs written for computer systems
System Software O
Application Software O
*
Application Software examples
Compilers and operating systems O
Word processors and spreadsheets O
* In C language
is invalid identifier
ABX O
ABX& O
ABX_A O
*In C language...... Declaration visible within function only
Global O
Local O
arrow_forward
Using the techniques presented during this semester create a complete C++ program to emulate an
Encryption/Decryption Machine. The machine will be capable of the following:
V Encrypt a string entered by the user
v Choose between two different encryption methods
V Decrypt a string entered by the user
Choose between two different decryptions methods
V Decrypt without knowing the encryption method (provide all possible outputs)
The interface must be professional and fully intuitive to the user
The program will be menu driven.
The program will use a class to define and implement each of the methods as member functions and will
store the original string and the encrypted/decrypted strings as data members.
In addition to using a class you must also use all the major structures we used this semester including:
Selection statements (if, if-else, switch) the appropriate one(s) of course
Loops (while, for, do-while) the appropriate one(s) of course
Standard Libraries (don't recreate the wheel)…
arrow_forward
Strict Warning ⚠️ don't you dare useany AI tool otherwise I'll report your account
arrow_forward
Describe the steps you take to run a Java application and the tools you use in each step. What are source files and bytecode files? What different types of errors are detected at each step?
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- Python Automation Script: write a python automation script that scrape gold rate from website automatically: get the latest(today's) gold rate in delhi from the website and change from previous day, and print the result on the screen.arrow_forwardment basic file input/output methods To verify, test, and debug any errors in the code Module learning outcomes assessed by this coursework: On successful completion of this assignment, students will be expected, at threshold level, to be able LO # 5: Software development environments (editor, interpreter, debugger), and programmi using Python programming language. Task: Students are required to create a Python program that performs customized Caesa encryption/decryption, as follows: A- The program should have a main menu, through which the user can choose whether he wants to encrypt a text or decrypt it. B- If the user chose to encrypt plaintext, he will be asked to enter his ID, which is also the name of the input file (i.e. if student ID is 199999, then the input file name should be 199999.txt). The user should not enter the file extension (i.e. .txt), instead, the program should append the extension to the ID automatically. C- The input file must contain the following information:…arrow_forwardPython supports the following file processing modes: read-only, write-only, and read-write.arrow_forward
- There are three main types of interface which enable us to interact with a computer. a) Identify the type of interface shown below b) Explain an advantage and disadvantage of using this type of interface C:\WINDOWSystem32\cmd.exe Microsoft Windows XP [Version 5.1.2600) (C) Copyright 1985-2881 Microsoft Corp. CINDocuments and Settings> c) Joe is the IT manager of a medium sized eCommerce company, Acme Ltd. There are several hundred employees working for the company's Head office. The Operating System they currently use is Microsoft Windows. Joe is keen to switch to a Linux Operating System as he thinks it will save money. Is Joe correct? What are some other issues he should consider before switching?arrow_forwardplease I need a python programme to help me with my question to discuss payment deatils please leave your contact info below in answer or commentarrow_forwardWrite a program that accepts two four-digit binary numbers, converts them to decimal values, adds them together, and prints both the decimal values and the result of the addition. Requirements: Functionality. (80pts) No Syntax Errors. (80pts*) *Code that cannot be compiled due to syntax errors is nonfunctional code and will receive no points for this entire section. Clear and Easy-To-Use Interface. (10pts) Users should easily understand what the program does and how to use it. Users should be prompted for input and should be able to enter data easily. Users should be presented with output after major functions, operations, or calculations. All the above must apply for full credit. Users must be able to enter a 4-bit binary number in some way. (10pts) No error checking is needed here and you may assume that users will only enter 0’s and 1’s, and they will only enter 4 bits. Binary to Decimal Conversion (50pts) You may assume that users will only give numbers that add up to…arrow_forward
- Python Automation Script: write a python automation script that scrape a website: get the latest(today's) gold rate in delhi from the website and change from previous day, and print the result on the screen.arrow_forwardQuestion • Computer Engineering lab You are assigned three tasks for this weekend, first you have to develop a script in F95 programming language to print the statement "Hikaru Nakamura is a top chess player" 10 times to the output window.arrow_forwardQuestion - 3) Using Visual studio demonstrate types of Errors in C#: (Submission Instruction: Take the screenshots of those errors and paste in the MS Word file and explain the cause of errors and how you can fix them) You may use the same project which you used in Question to show how can errors may occur and how you fix them. Types of errors you should demonstrate are : Syntax errors Runtime Errors Logical Errors [ 3| Pagearrow_forward
- PYTHON PROGRAMMINGarrow_forwardpython automation, how do you know which is relative xpath or absolute xpath? If your relative xpath doesn't work, what to check?arrow_forwardC LANGUAGE ONLY Limited Shell Through this program, you will learn to do the following: Work with processes using fork, pipe, wait, dup2, and the exec system calls. Additional practice with a Makefile with an all target Work with the different address spaces The main idea of this program is to write a limited function shell that only runs a few programs from a menu. Perform "four" small programs to start with followed by the menu program called newshell. Part 5. newshell Write a parent program similar to myshell.c but called newshell which will allow the user to choose from a menu of options. Usage would be: newshell 1 letters2 numbers3 firstname4 userinput5 letters > filename (letters redirected to a file)6 letters | userinput (letters piped to userinput)7 firstname| userinput (names piped to userinput)8 exit (your program should end by leaving the infinite loop.) These programs should be completed with the process commands fork, pipe, wait, dup2, and the 6 exec…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education