Question: 1. Write a python function, call it add_it_up (), that takes a single integer as input and returns the sumof integers from 0 up that
1. Write a python function, call it add_it_up (), that takes a single integer as input and returns the sumof integers from 0 up that integer.If a non integer is passed, it should return 0.b) show that the sum up to a specific n is equal to n(n+1)/2.
2. a) Write a program that reads in speed in mph and distance in miles and computes the time it willtake to travel.b) Write a program that plots time vs distance at three different speeds.
3. Read in numbers and store them into a list until the the number -1 is reached.
4. Write a program in python to take a list of of numbers A and put them into a sorted list B, using aselection sort, which finds the smallest number in A and puts it into the first element of the list B. Thenfind the second smallest element of the list and put it into the second element of B, etc.Show how the program works for a list:A = [5, 6,1, 2, 8, 9, 12, 18, 7, 10]
5. A variable defined inside a function is a local variable; otherwise it is a global variable. If a local variable has the same name as a global variable , the local variable is used inside thefunction.What does this print?def myFunc1 ():
one = -1
print (one, two)
one = 1
two = 2
print (one, two)
myFunc1 ()
print (one two)
6. The parameters in a functions parameter list match up with and get their values from the arguments in the argument-list of a function call in numerical order, not by parameter / argument name. What does this print?
Def myFunc2 (one, two, three):print (one, two, three)one = 1two = 2three = 3print (one, two, three)myFunc2 (two, three, one)print (one, two, three)7. Eliminate global variables with main functions.What does this print?def myFunc4 (one, two, three):sum = (one + two) threereturn sumdef main () :one = 1two = 2three =3result = myFunc4 (two, three, one)print (result)main ()8. Implement a program in Python that converts units of temperature from centegrade(celcius) to Faranheight and Faranheit to Celcius9. From Python, plot the Farenheit values vs. a range Centigrade values from 10 -100 0C.Properly label the axes.10.Implement the farmer, fox, goose, grain problem with start on one side of river and goal theother side as a goal-based agent design.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
