Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a new Python file by clicking File - > New File from the top - level menu bar on your IDLE interactive shell. In
Create a new Python file by clicking File New File from the toplevel menu bar on your IDLE interactive shell. In this new file, write a Python program with comments to do the following:
Assign a value of to a variable called x Use the print function to display the value of x with a suitable message
Assign a value of to a variable called y
Assign a value of to a variable called z Print the value of z with a suitable message
Calculate the value of x z and assign the result to a variable called answer Print the value of the answer with a suitable message
Calculate the value of x y x divided by y and assign the result to a variable called answer Print the value of the answer with a suitable message
Compute the result of integer division between x and y denoted as x y and assign the result to a variable called answer Print the value of the answer with a suitable message
Calculate the value of x y Reminder of x over y and assign the result to a variable called answer Print the value of the answer with a suitable message
Store your name in a variable called myname and display it using the print function with a suitable message
Use the input function to prompt the user to enter their favorite color's name. Assign their input to a variable named color. Then, print the value of color along with a suitable message
Enhance your source code by adding comments. Include your name and the date you're completing this assignment within the comments.
Save your file with the name labsol.py You can run your program by clicking Run Run Module in the window containing your labsol.py file; the output will appear in the IDLE shell, which is also where the user will enter any inputs required by the program.
Congratulations, you have just created and run your first Python program!!!
Submission: please submit your Python code ie your labsol.py file before the deadline through Brightspace. The program you wrote in step is the only thing you need to submit for this section of the lab
NOTE: In this course, the term 'suitable message' refers to a descriptive text accompanying printed output. For instance, simply printing the value lacks context for the user. However, printing x provides clarity about what is being printed, thus qualifying it as a 'suitable message' when outputting the value of x
NOTE: Please Do not submit a screenshot of the IDLE shell displaying your output. These will NOT be marked. You must submit only the labsol.py file for this part.
Please ensure that you submit two files one from Part A labsol.txt or labsol.pdf and another from Part B labsol.py on Brightspace before the deadline.
Evaluation: The marks awarded for this lab assignment are out of and will be assessed based on two main criteria. marks will be allocated for the completeness and correctness of the submitted solutions. The clarity and correctness of the provided explanation, descriptions, and comments will have the remaining marks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started