Hello,
Please answer below labs in separate documents with code and add screenshots as per the instrcutions given in PDF
Lab1A
Complete the following programming exercises given in the attached PDF “week1_labA.pdf” and submit only Word file as your answer—please do read the submission requirements carefully.
week1_labA.pdf
=====================================================
Lab1B
First complete Lab1A and then work on the following programming exercises given in the attached PDF “week1_labB.pdf” and please do read the submission requirements carefully.
Must follow the submission requirements.
week1_labB.pdf
Category: Python
Explanation: In Python, both append() and extend() methods are used to add eleme
Explanation: In Python, both append() and extend() methods are used to add elements to a list, but they behave differently:
append(): Adds its argument as a single element to the end of the list. If you pass a list as an argument to append(), it will be added as a nested list.
Example:
my_list = [1, 2, 3]my_list.append(4)
print(my_list) # Output: [1, 2, 3, 4]
extend(): Iterates over its argument (which should be an iterable, typically a list) and adds each element to the end of the list. It effectively flattens the iterable.
Example:
my_list = [1, 2, 3]
my_list.extend([4, 5, 6])
print(my_list) # Output: [1, 2, 3, 4, 5, 6]
In summary, append() adds one element to the list, while extend() adds elements from an iterable to the li
1. **Variables and Data Types:** a. Declare a variable `name` and assign your n
1. **Variables and Data Types:**
a. Declare a variable `name` and assign your name to it.
b. Create variables for storing an integer, a float, and a string.
2. **Conditional Statements:**
a. Write a program that checks if a given number is even or odd.
b. Create a program that determines whether a student’s grade is ‘A’, ‘B’, ‘C’, ‘D’, or ‘F’ based on their score.
3. **Loops:**
a. Write a loop that prints the numbers from 1 to 10.
b. Using a loop, calculate the sum of all numbers from 1 to 100.
4. **Lists:**
a. Create a list of your favorite colors and print the third color in the list.
b. Write a program to find the largest element in a given list of numbers.
5. **Functions:**
a. Define a function that takes two parameters and returns their sum.
b. Create a function that checks if a given number is prime.
6. **Dictionaries:**
a. Define a dictionary representing a person’s information with keys like “name,” “age,” and “city.”
b. Write a program that counts the frequency of each character in a given string using a dictionary.
7. **File Handling:**
a. Create a text file with a few lines of text. Write a program to read and print the contents of the file.
8. **Exception Handling:**
a. Write a program that asks the user for input and handles a ValueError if the input is not a number.
b. Create a program that opens a file and handles a FileNotFoundError if the file doesn’t exist.
9. **Classes and Objects:**
a. Define a class `Book` with attributes like title, author, and year. Create an object of the class.
b. Extend the `Car` class from the previous example with a method that calculates the mileage.
10. **Modules and Libraries:**
a. Import the `random` module and generate a random number between 1 and 100.
b. Use the `math` module to calculate the square root of a given number.
Prompt You have been asked to create a data table on the dashboard that shows an
Prompt
You have been asked to create a data table on the dashboard that shows an unfiltered view of the Austin Animal Center Outcomes data set. You have also been asked to add a geolocation chart to the dashboard, which will help the client visualize the data. For more details about the dash components for data tables and the geolocation chart, refer to the Module Six resources.
Open the ModuleSixMilestone-Template.ipynb file, which contains the starter code for the Grazioso Salvare dashboard. Upload this file into Apporto, and open it using the Jupyter Notebook application. Be sure to review all the starter code provided. Pay special attention to the import commands and the comments describing what each code section does.
Update the code to create an interactive data table on the dashboard that shows an unfiltered view of the Austin Animal Center Outcomes data set. To populate the data onto your table, you will use your previous CRUD Python module, from Project One, to run a “retrieve all” query and import the data from MongoDB. This data retrieval will access the “model” portion of your MVC pattern: the MongoDB database. Be sure to hardcode in the username and password for the “aacuser” account.
Note: The data table may take a few minutes to fully render and display, depending on the speed of your internet connection.
Tip: Be sure to consider your client when creating the interactive data table. Consider optional features that will make the table easier to use, such as limiting the number of rows displayed, enabling pagination (advanced), enabling sorting, and so on. Review the Module Six resources on data tables to help you select and set up these features.
Note: You must enable single-row selection for the data table for the mapping callback to function properly. This property is represented as: row_selectable = “single”
Add a geolocation chart that displays data from the interactive data table to your existing dashboard.You are being given the function that sets up accessing the data for the geolocation chart and calls the Leaflet function update_map:
def update_map(viewData, index):
dff = pd.DataFrame.from_dict(viewData)
# Because we only allow single row selection, the list can
# be converted to a row index here
if index is None:
row = 0
else:
row = index[0]
# Austin TX is at [30.75,-97.48]
return [
dl.Map(style={‘width’: ‘1000px’, ‘height’: ‘500px’},
center=[30.75,-97.48], zoom=10, children=[
dl.TileLayer(id=”base-layer-id”),
# Marker with tool tip and popup
# Column 13 and 14 define the grid-coordinates for
# the map
# Column 4 defines the breed for the animal
# Column 9 defines the name of the animal
dl.Marker(position=[dff.iloc[row,13],dff.iloc[row,14]],
children=[
dl.Tooltip(dff.iloc[row,4]),
dl.Popup([
html.H1(“Animal Name”),
html.P(dff.iloc[row,9])
])
])
])
]
You will need to structure this function into your dashboard code by adding the correct statements to the layout. These statements ensure your layout has a place for the geolocation chart. Here is an example statement:
html.Div(
id=’map-id’,
className=’col s12 m6′,
)
You will also need to add the correct callback routines to the geolocation chart. These will look similar to the callback routines used for user authentication and your data table. Here is an example callback routine:
@app.callback(
Output(‘datatable-id’, ‘style_data_conditional’),
[Input(‘datatable-id’, ‘selected_columns’)]
)Note: The Leaflet geolocation chart will show the row selected in the data table. To prevent issues with not selecting an initial row, you can set the selected row as a parameter to the DataTable method by adding the parameter:
selected_rows[0],
to the DataTable constructor, thereby selecting first row of the data table by default. As you select separate rows in the DataTable, the map should update automatically.
Finally, run the IPYNB file and take a screenshot of your dashboard as proof of this execution. Your screenshot should include 1) the interactive data table populated with the Austin Animal Center Outcomes data from MongoDB and 2) your geolocation chart showing the location of the first dog in the table. Additionally, your unique identifier (created in the Module Five assignment) should also appear in the screenshot.
What to Submit
To complete this project, you must submit a zipped folder containing both the IPYNB file with the code for your dashboard and the PY file containing your CRUD Python Module. All code files should follow industry-standard best practices, including well-commented code. You must also submit the screenshot of your dashboard as proof of your executions.
-Before you start, I recommend you read all of the information before you start
-Before you start, I recommend you read all of the information before you start coding.
Thank you
Step 1: Install Python
-Go to https://www.python.org/downloads/ and download Python for your system.
-Run the installer and check “Add Python to PATH” during installation.
Step 2: Choose a Code Editor
-Get Visual Studio Code from https://code.visualstudio.com/.
-Install and open VS Code.
Step 3: Create a New Python Document:
-After opening VS Code, you’ll see a welcome screen.
-Click on the “New File” button located at the top left corner (a blank sheet icon). This will open a new untitled file tab.
Step 4: Save Your Python Script
-Before you start your work, you need to know how to save it.
-It’s essential to save your work so you can come back to it later.
-Click on “File” again, but this time choose “Save As…”
-Choose a location on your computer where you want to save your Python programs. Create a new folder if you like.
-Give your file a name.
-Notice the “.py” extension; it indicates that this is a Python file.
6. Run Your Python Program:
-Now, it’s time to see your program in action.
-Open the terminal or command prompt on your computer. This is where you’ll interact with Python.
-Navigate to the folder where you saved your “hello.py” file.
You can use the cd command to change directories. For instance, if you saved it on your desktop:
” cd Desktop ”
-To run your program, type the following command and press Enter:
” python hello.py ”
-You should see the output on the screen
Step 6: learning the basics
(a) Print Statements:
-Use print() to display text or values.
-Example:
print(“Hello, World!”)
(b) Variables:
-Understanding variables is fundamental to programming.
-It’s like giving a name to something you want to store and use later.
-For example:
name = “Bob”
age = 15
(C) Data Types (Numbers, Strings, Booleans):
-These are the basic building blocks of information in Python.
-Numbers are self-explanatory, strings are sequences of characters (text), and booleans represent true or false values.
-For example:
score = 60
message = “Hello”
is_student = True
(d) Math Operations:
-Basic math operations like addition, subtraction, multiplication, and division are intuitive and practical.
-For example:
result = 10 + 5
(e) Input from Users:
-Gathering input from users with input() is straightforward and useful for creating interactive programs.
-For example:
name = input(“Enter your name: “)
(f) Conditionals (if statements):
-The concept of making decisions based on conditions using ‘if’, ‘elif’, and ‘else’ is essential, and its logic often mirrors everyday decision-making.
-For example:
age = 18
if age >= 18:
print(“You’re an adult.”)
else:
print(“You’re a minor.”)
-Once you’re comfortable with these basics, you can gradually move on to more advanced concepts like loops, functions, and more complex data structures.
-While Python is a fantastic language for beginners, it’s important to note that the choice of programming language ultimately depends on your goals and interests.
-Remember, learning to program is a gradual process. Don’t be discouraged by challenges; they’re all part of the learning experience. Start with small projects, experiment, and build your understanding over time. With practice and persistence, you’ll become more comfortable and confident in your Python skills.
-As you gain experience and confidence, you can always explore other languages if you’re curious about different aspects of programming.
-I would recommend Youtube for even more explanation and to get an ongoing step-by-step process.
Introduction to Programming & Python | Python Tutorial – Day #1 CodeWithHarry We
Introduction to Programming & Python | Python Tutorial – Day #1
CodeWithHarry
Welcome to 100 Days of Code
In this course, we will be learning Python programming from scratch to job-ready level in 100 days. By dedicating 100 days to this program and following the byte-sized lessons, you will master Python programming.
Python is a dynamically-typed, object-oriented programming language created by Guido van Russom in 1991. Its name was inspired by a TV show named Monty Python’s Circus, which Guido was watching at the time.
What to Expect
As we progress through the videos, we will start with the basics and move on to advanced topics. At first, you may find Python to be quite easy, but as we move forward, we will be raising the bar and working on complex projects that are used in industry.
Excitement and fun are guaranteed as we take you from zero to job-ready in just 100 days!
Get ready for lots of practice and challenges as we learn unique Python concepts together. Along with theory, we’ll be doing exercises and quizzes to reinforce our understanding. Don’t miss a day by subscribing and turning on notifications. Don’t get lost in the sea of YouTube – join the 100 days code challenge and write “I accept 100 days of code challenge” in the comments below.
We would like to design a MLP neural network to classify points whether they are
We would like to design a MLP neural network to classify points whether they are inside the shape given below
or not. other information is in the PDF, please do not use chat GPT because they can find it. the assignment should be done in the pAss2. pnyb
here in detail we learn about python,python features ,python limitations,python
here in detail we learn about python,python features ,python limitations,python development life cycle and more.
Download and unzip the NYC taxi dataset from Cyrille Rossant on GitHub: https://
Download and unzip the NYC taxi dataset from Cyrille Rossant on GitHub: https://github.com/ipython-books/minibook-2nd-data
Open the notebook file attached below.(PDF) You will be adding your code (make sure you add headers and comments) to the existing code, and make sure your code is well organized.
Please upload the data and display data columns, number of rows, variable types, and numeric statistics + categorical variable frequencies.
Display a scatter plot of drop off locations. For which vendor is it easiest to find a cab?
Display a histogram of trip distances. What is the most common trip distance?
Display a histogram of the fare total amounts. What can you say about the data?
How many unusually long trips (of greater than 100 miles) do you see?
Download and unzip the NYC taxi dataset (csv) Open the notebook file attached be
Download and unzip the NYC taxi dataset (csv)
Open the notebook file attached below.(PDF) You will be adding your code (make sure you add headers and comments) to the existing code, and make sure your code is well organized.
Please upload the data and display data columns, number of rows, variable types, and numeric statistics + categorical variable frequencies.
Display a scatter plot of drop off locations. For which vendor is it easiest to find a cab?
Display a histogram of trip distances. What is the most common trip distance?
Display a histogram of the fare total amounts. What can you say about the data?
How many unusually long trips (of greater than 100 miles) do you see?