Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 10 Use replace and int together to compute the time between between the the year 105 BCE (Ts'ai Lun invents paper based on tree

image text in transcribedimage text in transcribedimage text in transcribed

Question 10 Use replace and int together to compute the time between between the the year 105 BCE (Ts'ai Lun invents paper based on tree bark for the Emperor of China) and the year 1440 AD (Start of the Print Revolution. Try not to use any numbers in your solution, but instead manipulate the strings that are provided. Hint: It's ok to be off by one year. In historical calendars, there is no year zero, but astronomical calendars do include year zero to simplify calculations. invented = ' BC105 ' revolution = 'AD 1440' start = end = print(' The time between the first invention of paper and the print revolution is', end-start, 'years from', invented, 'to', re' check('tests/q10.py') Question 11 A 4-radian (45-degree) angle forms a right triangle with equal base and height, pictured below. If the hypotenuse (the radius of the circle in the picture) is 1 , then the height is sin(4). Compute that using sin and pi from the math module. Give the result the name sine_of_pi_over_four. (Source: [Wolfram MathWorld](http://mathworld.wolfram.com/images/eps-gif/TrigonometryAnglesPi4_1000.gif)) ]: \( \begin{array}{l}\text { sine_of_pi_over_four }=\ldots \\ \text { sine_of_pi_over_four }\end{array} \) ]: check('tests/q11.py' ) [ ]: \# Calculating factorials. math. factorial(5) [ ] : \# Calculating logarithms (the logarithm of 8 in base 2). \# The result is 3 because 2 to the power of 3 is 8. math. log(8,2) There's many variations of how we can import methods from outside sources. For example, we can import just a specific method from an ou source, we can rename a library we import, and we can import every single method from a whole library. [ ]: \# Importing just cos and pi from math. \# Now, we don't have to use "math." before these names. from math import cos, pi print (cos(pi)) [ ] : \# We can nickname math as something else, if we don't want to type the name math import math as m m. log(m.pi) [ ] : \# Lastly, we can import ever thing from math and use all of its names without "math." from math import * log(pi)

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

Students also viewed these Databases questions