Question
Code the following using python idle and be sure not to use the constructs in the prohibited list at the bottom unless specified in the
Code the following using python idle and be sure not to use the constructs in the prohibited list at the bottom unless specified in the question.
Note: 0 is neither positive or negative, so if a function requires a positive input and does not explicitly state zero, then zero is invalid. Also, many of these problems accept a percentage as one of their arguments. All of these problems will expect the percentage to be an integer on the interval [0, 100]. For example, 6% would be represented as 6. You will probably need to convert this to .06 by dividing by 100 within the function itself before performing any calculations.
Stock Profit The profit from the sale of a stock can be calculated as follows, profit =((NSSP)SC)((NSPP)+PC) Where NS is the number of shares purchase, SP is the sale price per share, SC is the commission paid, PP is the purchase price per share, and PC is the purchase commission paid. Write a function called stock_profit which takes the number of shares, the purchase price per share, the purchase commission paid, the sale price per share, and the sale commission paid as five arguments. The function should return the profit (or loss) from the sale of stock. stock_profit (100,25,100,30,75)# output: 525 Write a function named is_odd which takes no parameters. Your function should use a for loop to find all the odd numbers from 1 through 10 . If the number is an odd number, your function should print this number. If the number is an even number, your function should print "xxx is not an odd number" (you need to replace "xxx" with that number). is odd () # output (via print) 1 2 is not odd number 3 4 is not odd number 5 6 is not odd number 7 8 is not odd number 9 10 is not odd number 10 is not odd number directions. Using the following constructs will result in 0 (zero) for the entire submission (assignment, timed test, etc.). The restricted items are as follows: - Concepts not discussed in lectures yet - String functions - Member functions - Exceptions (can use) : /en () and x=x+[y1,y2,y3] - Built-in functions \& types - Exceptions (can use): str( ), readline( ), open(), close( ), write(), read(), range( ), .split() - Cannot use .append, .sort, etc. - Cannot use "Slicing" - Cannot use "list comprehension" - Cannot use "not in" (together) - Cannot use "in" - not allowed with conditionals - Exception (can use): with range () - Cannot use and \{\} - Exception (can use): mathematical operations (multiply \& exponents) - Data type functions - Exceptions (can use): int (), str (), float () - Break - Continue - Nested Constructs - Exceptions (can use): 2-D list - Multiple returns \& Multiple assignments - Recursion (not allowed unless the question explicitly states otherwise) - Functions within functions (Definitions) -- invocation is fine - Default Parameters - Global variables - Keyword as variable namesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started