Question: Problem 8 : Constructing an Output Message In this problem, you will be asked to define a single string variable msg to store a multiline
Problem : Constructing an Output Message
In this problem, you will be asked to define a single string variable msg to store a multiline message.
Create a code cell to perform the following steps:
Create a variable named first to store a string containing your first name.
Create a variable named last to store a string containing your last name.
Create a variable named sid to store an integer containing your student ID number. Ignore any leading zeros in your ID number. Note that the data type of sid should be stored as an integer.
Use the variables created above to define a variable named This variable should contain a string, that when printed, will display as shown below with the xxxx symbols replaced with the appropriate values. This will involve the use of the escape character
Print msg
Match the formatting shown below exactly, including the spacing. The message should be printed on three different lines, but the print function should be used only once. The values used to replace the xxxx symbols should be aligned with each other on the left. The output does NOT need to be indented.
First Name:
Last Name:
Student :
We will now determine the number of characters in our message variable.
Create a new code cell and use it to display the number of characters in string stored in msg You can use the len function to accomplish this task.
Submission Instructions
When you are done, click Kernel Restart and Run All. If any cell produces an error, then manually run every cell after that one, in order. Save your notebook, and then export the notebook as an HTML file. Upload the HTML file to Canvas and upload the IPYNB file to CoCalc, placing it in the HomeworkHW folder.
a
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
