Learning Goal: I’m working on a python project and need a sample draft to help me learn.
Need this done please so i could submit it. Follow the instructions email it to me.
INT-2240 – Introduction to Python
Practical Assignment 2
This assignment match the objectives in Module 2
- Create a document file (MS World, Google Docs, or equivalent) and name it after your name and the module number.
- For every task below:
- write your code which performs the task and run it. Display the code and the result on your screen;
- use a snipping (Windows snipping tool) or “print screen” tool to take one or two screenshots that contain the code and the result, and paste the illustration or picture into the document you created in 1. Your goal is to allow me to assess your code and its result.
- Submission: When all the tasks are completed, save and upload the document (1 document) and all 4 .py files (1 .py file per task) to the learning management system (Blackboard) as your assignment submission.
- DO NOT include or hard-code the test data into your code; your code should ask the user to input the data.
- Add a comment for every line of code.
- Each task is worth 10 points
Task 1 (10 points):
- becoming familiar with the concept of storing and working with different variables in Python;
- Solve a simple problem using a Python code
- experimenting with Python code.
A relative of yours who runs a bookstore and want you to help write a Python program to simulate the following scenario and get an idea of how to set the price of a book. The cover price of the book is $25.45, but bookstores get a 35% discount. Shipping costs $3 for the first 5 copies and $0.85 for each additional copy.
Your task is to write a program that will (1) prompt the user to enter the total number of copies the user plans to order. Then your code will (2) print the total cost of the entire order.
Use your own test data to show the performance of your code for the following inputs:
(For you to get the points, all the answers must be correct. I will write the code and check your answer before grading. If you write any of the number above in your code, you lose 60% of the points; use variables to receive the input from the user.)
Task 2 (10 points):
- becoming familiar with the concept of, and working with, variables;
- performing basic computations and conversions;
- experimenting with Python code.
Miles and kilometers are units of length or distance.
Bearing in mind that 1 mile is equal to approximately 1.61 kilometers, complete the program in the editor so that it converts:
- miles to kilometers;
- kilometers to miles.
Test your program with the data we’ve provided in the source code.
Pay particular attention to what is going on inside the print() function. Analyze how we provide multiple arguments to the function, and how we output the expected data.
Note that some of the arguments inside the print() function are strings (e.g., “miles is”, whereas some other are variables (e.g., miles).
7.38 miles is 11.88 kilometers
12.25 kilometers is 7.61 miles
Task 3 (10 points):
After completing the previous task, write a different converter of your choice, e.g., a USD to EUR converter, a temperature converter, etc. – let your imagination fly! Try to output the results by combining strings and variables. Try to use and experiment with the round() function to round your results to one, two, or three decimal places. Check out what happens if you don’t provide any number of digits. Remember to test your programs.
Experiment, draw conclusions, and learn. Be curious.
Task 4 (10 points):
- becoming familiar with the concept of numbers, operators and arithmetic operations in Python;
- understanding the precedence and associativity of Python operators, as well as the proper use of parentheses.
Your task is to complete the code in order to evaluate the following expression:
The result should be assigned to y. Be careful – watch the operators and keep their priorities in mind. Don’t hesitate to use as many parentheses as you need.
You can use additional variables to shorten the expression (but it’s not necessary). Test your code carefully.
Sample input: -5
y = -0.19258202567760344