Write in python idle 35 nothing else be very descriptive use

Write in python idle 3.5 nothing else be very descriptive. use function

Eile Edit Yew Hbtory Bookmarks bols Help Free Picks Daily Froo s bodysbats handicap picks... X O SakaieURI: Osc 110 Spri Chegg Study Guided Sol. Write In Python ldie 35 B. 12% e a bodys bets https sakai. uriedu/p ortal/sittele3dbb580-16f5-4901-aff0-88196032a87c 1. Write a program called the \'stocks.py that has the following features: Sample Code A- A getstocks function that gets from the user two lists, one containing the list of stock names and the second containing the list or stock prices. This should be done in a loop such that it keeps on getting a stock name and price until the user enters the string done as a stock name. The function should return both lists. Forums B- A searchstock function that takes three input parameters: the stockNames list, the stock Prices list and the string to search for a, It returns a single value pertaining to the found price. Note that if the stock name (s) is not found in the RNames st, then the function should return the value -1 as the stock price stock C- The printstock function takes three input parameters: the stockNanes list, the stoc Prices list and a price value p. The function should print the names of stocks whose price is higher than p. Schedule there are no values higher than p, then the function should print nothing. Note that this function returns nothing. Gradebook D- The main function calls the other functions described above to get the lists of stock names and prices, asks the user to enter the name of a stock to search for, and prints the stocks whose price is higher than the given stock price University Course Policies In total, the program should have four functions: s, seazchStock, printstock and main. Make sure to support your code with comments explaining what it does. Site Info Your output will look something like this Help g C) Enter the name of a stock (done if finished APPL Enter the price of APPL: 300 Enter the name of a stock (done if finished): GOOG Enter the price of G00G: 450 Enter the name of a stock (done if finished: IBM Enter the price of IBM: 275 Enter the name of a stock (done if finished done Enter the name of a stock that you would like to find the price of APPL The price of APP is 300.0 L Enter a price to find stocks with higher values: 295 The following stocks have prices higher than 295.0 APPL GOOG C) Enter the name of a stock (done if finished): APPL Enter the price of APPL: 300 Enter the name of a stock Cdone if finished GOOG Enter the price of G00G: 450 Enter the name of a stock (done if finished): IBM Enter the price of IBM: 275 Enter the name of a stock (done if finished): done Enter the name of a stock that you would like to find the price of: NTFLX That stock does not exist. Enter a price to find stocks with higher values: 500 The following stocks have prices higher than 500.0 None

Solution

Python3.5 code:

def getstocks():
   names = []
   prices = []
   while(True):
       print(\"Enter Stock name\")
       name = input().strip()
       if(name == \"done\"):
           return(names,prices)
       print(\"Enter Stock price\")
       price = int(input().strip())
       names.append(name)
       prices.append(price)

def searchstock(names,prices,s):
   for i in range (0,len(names)):
       if(s == names[i]):
           return prices[i]
   print(\"No stock found with name\", s)
   return -1
def printstock(names,prices,p):
   for i in range (0,len(prices)):
       if(p < prices[i]):
           print(names[i])  

if __name__ == \'__main__\':
   [names, prices] = (getstocks())
   print(\"Enter name of stock you want to find\")
   s = input().strip()
   print(searchstock(names,prices,s))
   print(\"Enter a price to find stocks with higher values\")
   p = int(input().strip())
   printstock(names, prices, p)

sample Output:

Enter Stock name
akash
Enter Stock price
11
Enter Stock name
priya
Enter Stock price
22
Enter Stock name
done
Enter name of stock you want to find
priya
22
Enter a price to find stocks with higher values
10
akash
priya

Write in python idle 3.5 nothing else be very descriptive. use function Eile Edit Yew Hbtory Bookmarks bols Help Free Picks Daily Froo s bodysbats handicap pick
Write in python idle 3.5 nothing else be very descriptive. use function Eile Edit Yew Hbtory Bookmarks bols Help Free Picks Daily Froo s bodysbats handicap pick

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site