Lab 1
.pdf
keyboard_arrow_up
School
New York University *
*We aren’t endorsed by this school
Course
1114
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
4
Uploaded by ChancellorDolphinMaster963
CS-UY 1113 - Lab 1
January 27th, 2023
You will need Python 3 installed on your laptop for this lab. Ideally, you would be using Idle or
Thonny as a development environment, which would include Python. If you need help with this,
please connect to a teaching assistant or instructor ASAP!
All lab work must be submitted to Gradescope before you leave the lab. You must try each
problem at least once. It is your responsibility to remember to submit your work. Gradescope is
odd in that when you submit one file, all previous submissions (are deleted). So be sure that
your final submission includes all solution files.
Problem 1
1.
Start Thonny on your computer.
2.
Select “New” from the “File” menu to create a new Python file. This will open a new,
empty file editing window.
3.
Name the file
lab1_p1.py
and save it somewhere where you can find it later. Note that
the file has a .py suffix. The lab assistants will instruct you how to submit this file to
Gradescope when you are finished.
4.
We want the file to contain basic information about the assignment: your name, your
course, the date, the name of the assignment. However, we want Python to ignore this
information, as it isn’t code and it’s useful only for a human being reading your file (e.g.
for your professor or TA). Such text to be ignored is called a comment. Write a comment
at the top of the file like this, but replace "Pat McStudent" with your name (both first and
last name)
# Pat McStudent
# CS - UY 1113
# 27 January 2023
# Lab 1
Notice that each line above begins with a pound-sign (#) to indicate that it is a comment.
Alternatively, you can write a comment like this:
"""
Pat McStudent
CS - UY 1113
27 January 2023
Lab 1
"""
1
Notice that the comment begins with three quotation marks in a row (
"""
) and continues
until the next three quotation marks in a row. Both of the above two syntaxes (using
#
or
using
"""
) are equivalent.
Text that is not part of a comment will be processed normally by Python and must obey
the usual rules of Python syntax. In the future, all submitted code for labs should begin
with such a comment header. Note that you may lose points in a problem if your solution
file does not include the comment header.
5.
Below the header, in this file, enter the following statement which will print a nice
greeting. Be sure to provide your name in the part where it says
"<your
name>"
, but
replace the
<your name>
with your name (leaving the double quotes).
print("Hello Professor DePasquale, my name is", "<your name>")
print()
print("In this class, I understand that I...")
print("* can work on labs with another student,")
print("* must work on all other graded work without outside help, and")
print("that if I am caught ", end="")
print("in violation of the Student Code")
print("of Conduct, I will be subject to disciplinary action.")
6.
Finally, before you upload to Gradescope, test the program by running it. Be sure that
the output your program produces is as shown below (including capitalization, spacing
and the comma!), but of course with your given and family name present.
Hello Professor DePasquale, my name is <your name>
In this class, I understand that I...
* can work on labs with another student,
* must work on homework without outside help, and
that if I am caught in violation of the Student Code
of Conduct, I will be subject to disciplinary action.
2
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
Automatic generation of Databases: Python
Would anyone have some tips/pointers on writing some code that takes an input file (csv) that contains a number of columns and rows such as Job title, Salary etc. but does not have information such as Name, Address, phone number etc. I have been messing around with the Python Library 'Faker' which has been doing well but I need some advice on making the overal user experience look better. Could someone recommend a good GUI library/package to test with. I love the look of Tableau Dashboards. I would like to be able to display possibly two to six different algorithmic stats to generate the fake data to then be saved in a new output file.A little bit of a strange question I know but any tips greatly appreciated :D
arrow_forward
Question 2
I need help with ii below
This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question.
Important note: you do not need to get a working program in part a. in order to attempt part b.
A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition:
> Convert binary to decimal
>> Input a list of six 1s and 0s corresponding to the binary number to be converted
>> Input a list of six column weightings consisting of powers of two
>> Create a new list…
arrow_forward
Project Description: The goal of this project is to write a program that can read data from any publicly available IoT source device and display it clearly to the user. The program will need to be written in Python (or any other programming language of your choice) and will need to include the following features:
1. Data Reading: The program should be able to read data from any publicly available IoT source device, such as a camera or any other sensor. The type of device is up to you, but they should be able to provide a valid URL for the device. The program should read the data from the device at regular intervals and store it in a data structure.
2. Data Display: The program should display the data that it reads from the IoT source device in a clear and easy-to-read format. The display could be in the form of a text-based output or a graphical interface, depending on your preference. The display should include information about the source sensor, as well as the data that was read…
arrow_forward
please answer right (python)
arrow_forward
Question 2 (18 marks)
This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question.
Important note: you do not need to get a working program in part a. in order to attempt part b.
A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition:
> Convert binary to decimal
>> Input a list of six 1s and 0s corresponding to the binary number to be converted
>> Input a list of six column weightings consisting of powers of two
>> Create a new list that contains the…
arrow_forward
Description
Greetings!
Task: Write a program that will ask for the user's name and output their name mixed with a command
line argument given as the greeting.
Command line args will be formally introduced next week, however, you're encouraged to do
some of your own research for this challenge! Python docs:
https://docs.python.org/3/library/sys.html#sys.argv
PYTHON
1 import sys
2
3 # e.g. $ python main.py foo bar
4 # Arguments would contain:
5
6 sys.argv[0] # => main.py
7 sys.argv[1] % => foo
8 sys.argv[2] # => bar
Your program should read the greeting from command line arguments, ask the user for their
name, and then output a custom greeting, like so:
Example 1
$ python greet.py Yo!
What's your name? Jamal
Yo! Jamal
Example 2
$ python greet.py "G'day"
What's your name? Summer
G'day Summer
Tip: For G'day, be sure to include in double quotes, so Bash treats it as one argument.
arrow_forward
Converting a Program Design to Python Code [10 marks]
This exercise should be done in the "Exercise1" file provided to you. In class, we've been drawing
up designs in English for programs we want to write. We've then used these code designs to create
programs in Python code. For now, I've given you a code design and your job is to convert the
design into Python code.
Below l'll first provide an example for you. On the left is a code design and on the right is the
associated Python code. You need not type it in if you don't want to; it's just an example of a code
design and its corresponding code.
Design:
Create a variable 'num1' and store the
number 4 in it
Code:
num1 = 4
Ask the user for a number; store this in
variable 'num2'
num2 = int(input("Enter a number:")
Add variables num1 and num2 and
total = num1 + num2
store the result in variable 'total'
Display "The total is:"
Display variable 'total'
print("The total is:")
print(total)
YOUR TASK: Convert the following code design into…
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
Use the Internet to research the history of the Python programming language, and answer the following questions:• Who was the creator of Python?• When was Python created?• In the Python programming community, the person who created Python is commonly referred to as the “BDFL.” What does this mean?
arrow_forward
PLEASE CODE IN PYTHON
Problem DescriptionBoring is a type of drilling, specifically, the drilling of a tunnel, well, or hole in the earth. With some recent events, such as the Deepwater Horizon oil spill and the rescue of Chilean miners, the public became aware of the sophistication of the current boring technology. Using the technique known as geosteering, drill operators can drill wells vertically, horizontally, or even on a slant angle.
A well plan is prepared before drilling, which specifies a sequence of lines, representing a geometrical shape of the future well. However, as new information becomes available during drilling, the model can be updated and the well plan modified.Your task is to write a program that verifies validity of a well plan by verifying that the borehole will not intersect itself. A two-dimensional well plan is used to represent a vertical cross-section of the borehole, and this well plan includes some drilling that has occurred starting at (0, −1) and moving…
arrow_forward
Please explain the factors that can lead a designer to choose for a bottom-up approach to development instead of a top-down one. Python
arrow_forward
Who is the creator or founder of Python programming? What is his nickname?
Why was Python chosen as the name for Python Programming?
Search at schools/online courses/classes that teach Python programming.
Provide a course outline as well as a rate/price for their service.
arrow_forward
Help me in C#.
arrow_forward
Need some assistance for this part of my homework. It's meant to be done on Jupyterlab
arrow_forward
Looping is an essential component of any script or application written in Python. Looping allows you to run repeated operations without copying code. This Discussion Board is designed to help illustrate each loop type and when to use a particular loop type. Select either the For or While loop and provide the following in your Discussion Board post: A description of what the loop does An example of why you would use the loop you selected over the other Remember to use a reference to your learning materials or an outside source in at least one post each week.
arrow_forward
A programmer develops code by repeating short sessions of writing, compiling, and testing until the project is finished. This is an example of _____.
A. Pair programming
B. Modular development
C. Incremental development
D. Parallel programming
arrow_forward
pls help! write a program from the following in assembley language code. you can you the online simulator lc3 https://wchargin.com/lc3web/ .pls help me i am really confused!
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
- Automatic generation of Databases: Python Would anyone have some tips/pointers on writing some code that takes an input file (csv) that contains a number of columns and rows such as Job title, Salary etc. but does not have information such as Name, Address, phone number etc. I have been messing around with the Python Library 'Faker' which has been doing well but I need some advice on making the overal user experience look better. Could someone recommend a good GUI library/package to test with. I love the look of Tableau Dashboards. I would like to be able to display possibly two to six different algorithmic stats to generate the fake data to then be saved in a new output file.A little bit of a strange question I know but any tips greatly appreciated :Darrow_forwardQuestion 2 I need help with ii below This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question. Important note: you do not need to get a working program in part a. in order to attempt part b. A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition: > Convert binary to decimal >> Input a list of six 1s and 0s corresponding to the binary number to be converted >> Input a list of six column weightings consisting of powers of two >> Create a new list…arrow_forwardProject Description: The goal of this project is to write a program that can read data from any publicly available IoT source device and display it clearly to the user. The program will need to be written in Python (or any other programming language of your choice) and will need to include the following features: 1. Data Reading: The program should be able to read data from any publicly available IoT source device, such as a camera or any other sensor. The type of device is up to you, but they should be able to provide a valid URL for the device. The program should read the data from the device at regular intervals and store it in a data structure. 2. Data Display: The program should display the data that it reads from the IoT source device in a clear and easy-to-read format. The display could be in the form of a text-based output or a graphical interface, depending on your preference. The display should include information about the source sensor, as well as the data that was read…arrow_forward
- please answer right (python)arrow_forwardQuestion 2 (18 marks) This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question. Important note: you do not need to get a working program in part a. in order to attempt part b. A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition: > Convert binary to decimal >> Input a list of six 1s and 0s corresponding to the binary number to be converted >> Input a list of six column weightings consisting of powers of two >> Create a new list that contains the…arrow_forwardDescription Greetings! Task: Write a program that will ask for the user's name and output their name mixed with a command line argument given as the greeting. Command line args will be formally introduced next week, however, you're encouraged to do some of your own research for this challenge! Python docs: https://docs.python.org/3/library/sys.html#sys.argv PYTHON 1 import sys 2 3 # e.g. $ python main.py foo bar 4 # Arguments would contain: 5 6 sys.argv[0] # => main.py 7 sys.argv[1] % => foo 8 sys.argv[2] # => bar Your program should read the greeting from command line arguments, ask the user for their name, and then output a custom greeting, like so: Example 1 $ python greet.py Yo! What's your name? Jamal Yo! Jamal Example 2 $ python greet.py "G'day" What's your name? Summer G'day Summer Tip: For G'day, be sure to include in double quotes, so Bash treats it as one argument.arrow_forward
- Converting a Program Design to Python Code [10 marks] This exercise should be done in the "Exercise1" file provided to you. In class, we've been drawing up designs in English for programs we want to write. We've then used these code designs to create programs in Python code. For now, I've given you a code design and your job is to convert the design into Python code. Below l'll first provide an example for you. On the left is a code design and on the right is the associated Python code. You need not type it in if you don't want to; it's just an example of a code design and its corresponding code. Design: Create a variable 'num1' and store the number 4 in it Code: num1 = 4 Ask the user for a number; store this in variable 'num2' num2 = int(input("Enter a number:") Add variables num1 and num2 and total = num1 + num2 store the result in variable 'total' Display "The total is:" Display variable 'total' print("The total is:") print(total) YOUR TASK: Convert the following code design into…arrow_forwardSan 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_forwardUse the Internet to research the history of the Python programming language, and answer the following questions:• Who was the creator of Python?• When was Python created?• In the Python programming community, the person who created Python is commonly referred to as the “BDFL.” What does this mean?arrow_forward
- PLEASE CODE IN PYTHON Problem DescriptionBoring is a type of drilling, specifically, the drilling of a tunnel, well, or hole in the earth. With some recent events, such as the Deepwater Horizon oil spill and the rescue of Chilean miners, the public became aware of the sophistication of the current boring technology. Using the technique known as geosteering, drill operators can drill wells vertically, horizontally, or even on a slant angle. A well plan is prepared before drilling, which specifies a sequence of lines, representing a geometrical shape of the future well. However, as new information becomes available during drilling, the model can be updated and the well plan modified.Your task is to write a program that verifies validity of a well plan by verifying that the borehole will not intersect itself. A two-dimensional well plan is used to represent a vertical cross-section of the borehole, and this well plan includes some drilling that has occurred starting at (0, −1) and moving…arrow_forwardPlease explain the factors that can lead a designer to choose for a bottom-up approach to development instead of a top-down one. Pythonarrow_forwardWho is the creator or founder of Python programming? What is his nickname? Why was Python chosen as the name for Python Programming? Search at schools/online courses/classes that teach Python programming. Provide a course outline as well as a rate/price for their service.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