Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is for my Python class. jupyter LynsiFrederick_Lab1.253868 (autosaved) Kemel Widgets Help Logout File Edit View Insert Cell Not Trusted Python 3 C CS 497
This is for my Python class.
jupyter LynsiFrederick_Lab1.253868 (autosaved) Kemel Widgets Help Logout File Edit View Insert Cell Not Trusted Python 3 C CS 497 Lab 1 Instructions 0. Rename this file username lab1. Not literally, yourName lab1 (technically correct, the best kind of correct!) but use your BU ID to fill in yourName. If I was submitting this lab, it would be called dbrennan lab1 1. Read all instructions carefully, ask questions if anything is confusing 2. Fill in the code/text blocks to answer each question. 3. Do not change any of the existing code provided. The code is specifically there to help you! 4. Run the entire notebook before submitting it on Sakai to make sure that the code actually runs without errors 5. Important: Any question for which your code fails to run will receive 0 points 6. Have fun! 7. Extra credit (if applicable) will only be granted if this lab is turned in before the end of class 8. Do not import any packages! Any packages available to you are designed to be used from their import statement down. Example: Problem 1 doesn't have any import statements. Problem 2 imports one package called "A". Problem 3 imports one package called B". You may not use "A" or "B" for problem 1, you may not use "B" for problem 2 and you may use both for problem 3. If you were to restart and rerun all cells in your notebook you would not be able to use a package prior to importing it so it logically makes sense as well! Question 1 30 points Please sum up the numbers from 1 to N where, you choose to set N below. The formula for the summation is provided, check your work! This would look like 2 if we were in a math class. In [1]: ##Your code below, you may change n to any value Question 2 30 points Its quite cold outside. Don't go outside. If you've always wondered how wind chill is calculated, today is your lucky day! The formula for calculating wind chill in T degrees Celsius and v km/hour is given below: Implement the above formula carefully, the wind chill at v-21, and T-27 yields a wind chll of-39.6 (remember these are metric measurements!) 0 deg C and 30 km/h yields a WC of -6.5 In [ ]: H ##Your code below, but change the values of T/v to test both pairs t27 Question 3 40 points + 5 points EC You will be building your own quadratic equation solver! Since we aren't importing the math library we will rely on the*exponent we saw in class on Monday. The quadratic equation ax2 + bx + c 0 can be solved by root 1 ls-b-v 4 and root 2 is H2 4 Now of course when the inside of the square root is less than zero we work with imaginary numbers. For extra credit, you will find a way to print out those -b-Vb-4ac imaginary roots. I'll leave how you handle that up to you. For normal credit, merely print out the two roots (with the provided print statement) a-2b:5,c--3 should yield roots of-3 and .5 In [7]: root1-0 root2-0 C-3 ##Write your code below, modify root! and root2 accordingly print "Root 1 is:",root1) print("Root 2 is:",root2) Root 1 is:0 Root 2 is: 0 In t 1: MStep 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