Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Data Types and Variables Variables (names) are central to coding in any programming language and can store numbers, strings such as Hello World, and
1. Data Types and Variables Variables (names) are central to coding in any programming language and can store numbers, strings such as "Hello World", and even whole data sets. It is important that we understand the concept of data type because in coding the functions that we can use to alter the values stored in variables depend on the data type. 1]: number =6.75 2] : 2]: int The variable, number contains a value with a datatype of float meaning floating point number. A float can be converted to an integer with the int Python function. 2]: int(6) 2] : 6 7]: inumber =int(7) Below determine the type of 4]: type(6) 4] : int A string is another data type, test this out by checking the type of dogname defined above. \# t, the duration of the fall in the experiment, in seconds. \# Fill this in. time =.. \# The estimated distance the hammer actually fell, in meters, \# Fill this in. estimated_distance_m =d print('tests/q3.py') tests/q3.py Now, complete the code in the next cell to compute the difference between the predicted and estimated distances (in meters) that the hammer fell in this experiment. This just means translating the formula above (21GR2Mt2) into Python code. You'll have to replace each variable in the math formula with the name we gave that number in Python code. \# First, we've written down the values of the 3 universal \# constants that show up in Newton's formula. \# G, the universal constant measuring the strength of gravity. gravity_constant =6.6741011 \# M, the moon's mass, in kilograms. moon_mass_kg =7.347673091022 #, the radius of the moon, in meters. moon_radius_m =1.737106 \# The distance the hammer should have fallen over the \# duration of the fall, in meters, according to Newton's \# Law of gravity. The text above describes the formula \# for this distance given by Newton's law. \# **YOU FILL THIS PART IN.** predicted_distance_m = \# Here we've computed the difference between the predicted \# fall distance and the distance we actually measured. \# If you've filled in the above code, this should just work. difference = predicted_distance_m - estimated_distance_m difference
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