Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Given a variable n refers to a positive int value, use two additional variables, k and total to write a for loop to compute the sum of the cubes of the first n counting numbers, and store this value in total. Thus your code should put 1*1*1 + 2*2*2 + 3*3*3 +... + n*n*n into total. Use no variables other than n, k, and total.
Write a function flipSwitches that accepts one argument, a sequence of upper or lower case letters (the sequence can either be a str or a list, if you write your code correctly, it shouldn’t matter). This is a sequence of switches, uppercase means to turn a switch on, and lowercase to turn a switch off. For example, ‘A’ means to turn the switch ‘A’ on, and ‘a’ means to turn the switch ‘A’ off. The function should then return the set of those switches that are still on at the end of the sequence of switches. To receive full credit, your code must use a set that keeps track of the switches that are on.You can then iterate over the sequence and modify the set of switches that are on as appropriate.
>>> flipSwitches( ['A','A','a','B'] )
{'B'}
2. Write a function moreOdds that accepts one argument, a list of integers. The function then returns a bool that indicates whether the list contains(strictly) more odd numbers than even numbers. Sample output:

>>> moreOdds( [2,3,4,5,7] )
True
1. Write a function hideShow that accepts two string arguments, an input string and a masking string. The masking string is a string consisting of ‘0’s and ‘1’s that has the same length as the input string. The function then returns a new string that is the same as the input string, except that it is masked. That is, in any position where the masking string contains a ‘0’ the input character is replaced by a ‘#’, whereas if the masking string contains a ‘1’, the character is unchanged. See the following sample output:
>>> hideShow( 'apple', '11001')
'ap##e'
>>> hideShow('apple','00000')
'#####'
>>> hideShow('apple','11111')
'apple'
>>> hideShow('abcdefghijklmnopqrstuvwxyz',13*'01')
'#b#d#f#h#j#l#n#p#r#t#v#x#z'
>>> hideShow( 'df###re##', '101010101' )
'd#####e##'
>>>
An important component to becoming an effective programmer is:
Write a program to help you feed your friends at a party by doing some math about square pizzas. Assume the grader defines a string inputStr for you, which is a decimal string meaning the side length L of the pizza in cm. The area of the pizza should be computed using the formula A = L*L. Then, assuming that each person needs to eat 100 cm2 of pizza, compute the number of people it can feed, rounded down to the nearest integer.
Write a program which reads an integer from input using pancakes = int(input()). If pancakes is more than 3, print out Yum! and if pancakes is not more than 3, print out Still hungry! instead.
Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and associates that value with total. Thus your code should associate 1*1 + 2*2 + 3*3 +... + 49*49 + 50*50 with total. Use no variables other than k and total.
Create a Python program with two functions, FunctionA(str1,str2) and FunctionB(str3).
how do u code the silly assignment on edhesive.
LATEST TUTORIALS
APPROVED BY CLIENTS