Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Section 1: multiple choice Data Types: The following is what data type: number = 23 a.string b.float c.list d.integer. e.dictionary The following is what data

Section 1: multiple choice

Data Types:

The following is what data type:

number = 23

a.string

b.float

c.list

d.integer.

e.dictionary

The following is what data type:

number = "

Hello World!

"

a.string

b.float

c.list

d.integer

e.dictionary

The following is what data type:

shopping_list = {1: "kale",

2: "almond milk",

3: "olive oil",

4: "walnuts"}

a.string

b.float

c.list

d.integer

e.dictionary

The following is what data type:

class_list = ["differential equations",

"python for finance",

"data structures",

"algorithms"]

a.string

b.float

c.list

d.integer

e.dictionary

If you wanted to find out the type of a variable in Python called number, which command would you use?

A.type(number)

B.typeof(number)

C.number.class

Section 2: programming

Program 1:

Account management of our software has a request from a

client to build a basic calculator using python that has the following

criteria:

input your choice 1 4 (these get added as functions)

1 is to add

2 is to subtract

3 is to multiply

4 is to divide

print out what you chose in terms of if you picked 2 it would say

you chose to subtract

enter number 1 as x

enter number 2 as y

print out the answer

Here is an example of one of the functions (you need 4)

# example of one of the calculator functions

def add(x, y) :

return x + y

Here is an example of printing out your choice:

Choice_dictionary = {1: "add",

2: "subtract",

3. "multiply",

4. "divide"}

for i in choice_dictionary:

if choice == i:

print "you chose: " + choice_dictionary[i]

Section 3:

Pi = Poert

P means population. Po is population start and Pi is population finish.

It basically means how much population growth happens.

e is a constant and is approximately 2.718281828

you can also import math and go math.e

r is the growth rate which has to be converted to a decimal by dividing by 100. So if growth rate is 1.6, it is 0.16 by making it 1.6/100

t is time. So it can be hours in terms of bacteria or years in terms of population growth. This also works for money growth.

Write a function that returns the population growth number.

The arguments you need to pass into the function is

P = starting population

r = population growth rate

t = time

and it should return the finishing population.

If the starting population in the US in 1920 was 100 million, and the growth rate is approximately 1.234 from 1920 to 2014. What does your final population give? It should be around 318 million

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

Recommended Textbook for

Statistical And Scientific Database Management International Working Conference Ssdbm Rome Italy June 21 23 1988 Proceedings Lncs 339

Authors: Maurizio Rafanelli ,John C. Klensin ,Per Svensson

1st Edition

354050575X, 978-3540505754

More Books

Students also viewed these Databases questions

Question

Command to inspect permissions

Answered: 1 week ago