Section2.1
Celsius=eval(input("Enter a degree in Celsius:"))
Fahrenheit=(9/5)*Celsius+32
print(Celsius, "Celsius is", Fahrenheit, "Fahrenheit")
?Section2.6
num=eval(input("Enter a number between 0 and 1000:"))
a=num%10
b=(num//10)%10
c=(num//10)//10
sum=a+b+c
print("The sum of the digits is", sum)
Section2.11
finalAccountValue = eval(input("Enter final account value:"))
monthlyInterestRate = eval(input("Enter annual interest rate in percent:"))
numberOfMonths = eval(input("Enter number of years:"))
initialDepositAmount = finalAccountValue / (1 + monthlyInterestRate/12/100)**(numberOfMonths*12)
print("Initial deposit value is", initialDepositAmount)
?Section2.16
v0, v1, t = eval(input("Enter v0,v1, and t:"))
a = (v1 - v0) / t
print("The average acceleration is ", a)
?Section2.21
savingAmount = eval(input("Enter the monthly amount:"))
sum = 0
for i in range(0,6):
i=i+1
sum=(savingAmount+sum)*(1+0.00417)
print("After the sixth month, the account value is:", sum)
?Section2.23
import turtle
r = eval(input("Enter the radius:"))
turtle.penup()
turtle.goto(r, r)
turtle.pendown()
turtle.circle(r)
turtle.penup()
turtle.goto(-r, r)
turtle.pendown()
turtle.circle(r)
turtle.penup()
turtle.goto(-r, -r)
turtle.pendown()
turtle.circle(r)
turtle.penup()
turtle.goto(r, -r)
turtle.pendown()
turtle.circle(r)
turtle.done()
?Section2.26
x, y = eval(input("Enter the center:"))
radius = eval(input("Enter the radius:"))
area = 3.14 * radius * radius
import turtle
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.write(area)
turtle.penup()
turtle.goto(x, y - radius)
turtle.pendown()
turtle.circle(radius)
turtle.hideturtle()
turtle.done()
?
|