Answered step by step
Verified Expert Solution
Link Copied!

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 top-level 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 25 to a variable called x. Use the print() function to display the value of x with a suitable message1.
Assign a value of 7 to a variable called y.
Assign a value of 10.8 to a variable called z. Print the value of z with a suitable message1.
Calculate the value of x +(z *2) and assign the result to a variable called answer_1. Print the value of the answer_1 with a suitable message1.
Calculate the value of x / y (x divided by y) and assign the result to a variable called answer_2. Print the value of the answer_2 with a suitable message1.
Compute the result of integer division between x and y, denoted as x // y, and assign the result to a variable called answer_3. Print the value of the answer_3 with a suitable message1.
Calculate the value of x % y (Reminder of x over y) and assign the result to a variable called answer_4. Print the value of the answer_4 with a suitable message1.
Store your name in a variable called my_name and display it using the print() function with a suitable message1.
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 message1.
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 lab1sol.py. You can run your program by clicking Run -> Run Module in the window containing your lab1sol.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 (i.e., your lab1sol.py file) before the deadline through Brightspace. The program you wrote in step 3 is the only thing you need to submit for this section of the lab2.
1NOTE: In this course, the term 'suitable message' refers to a descriptive text accompanying printed output. For instance, simply printing the value 22 lacks context for the user. However, printing 'x =22' provides clarity about what is being printed, thus qualifying it as a 'suitable message' when outputting the value of x.
2NOTE: Please Do not submit a screenshot of the IDLE shell displaying your output. These will NOT be marked. You must submit only the lab1sol.py file for this part.
----------------------------------------------
Please ensure that you submit two files one from Part A (lab1sol.txt or lab1sol.pdf), and another from Part B (lab1sol.py) on Brightspace before the deadline.
Evaluation: The marks awarded for this lab assignment are out of 10 and will be assessed based on two main criteria. 6.5 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 3.5 marks.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

Students also viewed these Databases questions

Question

Discuss how selfesteem is developed.

Answered: 1 week ago