Question

In Python def main(): c = 10 print("Welcome to Roderick's Chikkin and Gravy") e = False...

In Python

def main():

c = 10

print("Welcome to Roderick's Chikkin and Gravy")

e = False

while not e:

x = input("Would you like some chikkin?")

if x == "Y" or x == "y":

c = f(c)

else:

e = True

if c == 0:

e = True

print("I hope you enjoyed your chikkin!")

def f(c):

if c > 0:

print("Got you some chikkin! Enjoy")

return c-1

else:

print("No chikkin left. Sorry")

return 0

main()

For practice with lists, create a Python repl that does the following: A user will type in 10 numbers. It then calculates and outputs the standard deviation (SD) of those numbers. The formula to use for the SD is found through the following mini-algorithm:

1. Find the average of the values.

2. Find the sum of the square of the difference between each item you read in and the average. So, if I only have 3 inputs 1,2,3, the average is 2 so the sum of the square of the differences is: (2-1)^2 + (2-2)^2 + (2- 3)^2 = 2 (in this example).

3. Divide the value in the previous step by 9 (for 10 numbers).

4. Take the square root of the value from the previous step.

Homework Answers

Answer #1

If you like the solution please give it a thubs up. And if you have any query please let me know in the comments.

Solution :-

python code :-

lst = []   
# number of elemetns as input 
n = 10
print("enter the numbers :- ");  
for i in range(0, n): 
    temp = int(input()) 
    lst.append(temp)

# find average for list
mean = sum(lst)/len(lst)

# find variance for list
variance = sum([((x - mean) ** 2) for x in lst])

variance = variance/(n-1)

# take square root of variance for std deviation
stdDev = variance ** 0.5

print("standard deviation = " , stdDev)

Sample input /Output :-

enter the numbers :-
23
45
67
1
34
56
8
97
23
26
standard deviation = 29.00957696271277

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am a student taking python programming. Can this problem be modified using the define main...
I am a student taking python programming. Can this problem be modified using the define main method, def main()? import random #function definition #check for even and return 0 if even def isEven(number): if(number%2==0): return 0 #return 1 if odd else: return 1 #count variables even =0 odd = 0 c = 0 #loop iterates for 100 times for i in range(100): #generate random number n = random.randint(0,1000) #function call val = isEven(n) #check value in val and increment if(val==0):...
Please answer this using def (functions) in python 3 with a single print statement under #main....
Please answer this using def (functions) in python 3 with a single print statement under #main. Is this possible to do in one print as output? User specifies the number of books ordered, and if the order is online, or not. You can collect the second input by asking the user to enter 1 for online, and 0 for offline. You can assume that the user will enter 1 or 0 as directed. Unit price for a book is 15$....
convert this code to accept int value instead of float values using python. Make sure to...
convert this code to accept int value instead of float values using python. Make sure to follow the same code. do not change the steps and make sure to point to what code you replaced. make sure to have 2 files Method:----------------------- #define a python user difined method def get_float_val (prompt): is_num = False str_val = input (prompt) #prming read for our while #while is_num == False: (ignore this but it works) old school while not is_num: try: value =...
Python Blackjack Game Here are some special cases to consider. If the Dealer goes over 21,...
Python Blackjack Game Here are some special cases to consider. If the Dealer goes over 21, all players who are still standing win. But the players that are not standing have already lost. If the Dealer does not go over 21 but stands on say 19 points then all players having points greater than 19 win. All players having points less than 19 lose. All players having points equal to 19 tie. The program should stop asking to hit if...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following questions using the list below. You can record your answers in the essay textbox. data = [5,3,7] A. Write code to replace the value in the 0 position with the number 8. B. Add the value 10 to the end of the list. C. Insert the value 22 after position 1 in the list. D. Remove the value at position 2. E. Sort the...
write a code in python Write the following functions below based on their comments. Note Pass...
write a code in python Write the following functions below based on their comments. Note Pass is a key word you can use to have a function the does not do anything. You are only allowed to use what was discussed in the lectures, labs and assignments, and there is no need to import any libraries. #!/usr/bin/python3 #(1 Mark) This function will take in a string of digits and check to see if all the digits in the string are...
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop...
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop (instead of for). • The function takes a single integer n as a parameter • The function prints a series between 1 and that parameter, and also prints its result • The result is calculated by summing the numbers between 1 and n (inclusive). If a number is divisible by 5, its square gets added to the result instead. • The function does not...
Using a for Loop visual c++ Summary In this lab the completed program should print the...
Using a for Loop visual c++ Summary In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. Instructions Write a for loop that uses the loop control variable to take on the values 0 through 10. In the body of the loop, multiply the value of the loop control variable by 2 and...
The decimal values of the Roman numerals are: M D C L X V I 1000...
The decimal values of the Roman numerals are: M D C L X V I 1000 500 100 50 10 5 1 Remember, a larger numeral preceding a smaller numeral means addition, so LX is 60. A smaller numeral preceding a larger numeral means subtraction, so XL is 40. Assignment: Begin by creating a new project in the IDE of your choice. Your project should contain the following: Write a class romanType. An object of romanType should have the following...
Program will allow anywhere between 1 and 6 players (inclusive). Here is what your output will...
Program will allow anywhere between 1 and 6 players (inclusive). Here is what your output will look like: Enter number of players: 2 Player 1: 7S 5D - 12 points Player 2: 4H JC - 14 points Dealer: 10D Player 1, do you want to hit? [y / n]: y Player 1: 7S 5D 8H - 20 points Player 1, do you want to hit? [y / n]: n Player 2, do you want to hit? [y / n]: y...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT