Question: Question B 1 ( Python ) ( i ) Given the following code defining Sam's age, can you write code using an f - string
Question BPython
i Given the following code defining Sam's age, can you write code using an fstring to print "Sam is years old"?
age
marks
ii Given the following code defining Sam's age and number of pets in the object Saminfo, can you write code using either an fstring or string format method to print "Sam is years old and has pets"?
nfo 'age': 'pets':
marks
iii Given a DataFrame df can you write code to select the rows a and b and the columns and
marks
iv Write a line of code to read a csv file "mydata.csv into a DataFrame df assuming that the first row of the csv file contains the column names.
Write code to plot the first column of df against the second column using the plot function from pyplot only partial credit will be given for other approaches, even if the approach is superior
marks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
