subject

Ok, this is for computer science we’re suppose to make a program that takes a user input and the user’s input is suppose to be the total of a list. This is what I’ve got so far and my teacher said I was close but I shouldn’t use User_Number in the parameter. ( the indents are in the code for some reason they didn’t carry over thou )

User_Number = input(“What should the sum of numbers be? “)

Def Total(User_Number):

i = 1

numbers = [ ]

while i <= User_Number:

numbers. append( i )

i += 1

Sum_Total = 0

For i in numbers:

Sum_Total += numbers[ i - 1 ]

return Sum_Total

if __name__ == ‘__main__’:

print( Total )

The only things that must be in the program is: user input, a def statement with a parameter, the if name = min statement, and no preexisting functions for the math

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
)a grad student comes up with the following algorithm to sort an array a[1..n] that works by first sorting the first 2/3rds of the array, then sorting the last 2/3rds of the (resulting) array, and finally sorting the first 2/3rds of the new array. 1: function g-sort(a, n) . takes as input an array of n numbers, a[1..n] 2: g-sort-recurse(a, 1, n) 3: end function 4: function g-sort-recurse(a, `, u) 5: if u ⒠` ≤ 0 then 6: return . 1 or fewer elements already sorted 7: else if u ⒠` = 1 then . 2 elements 8: if a[u] < a[`] then . swap values 9: temp ↠a[u] 10: a[u] ↠a[`] 11: a[`] ↠temp 12: end if 13: else . 3 or more elements 14: size ↠u ⒠` + 1 15: twothirds ↠d(2 ◠size)/3e 16: g-sort-recurse(a, `, ` + twothirds ⒠1) 17: g-sort-recurse(a, u ⒠twothirds + 1, u) 18: g-sort-recurse(a, `, ` + twothirds ⒠1) 19: end if 20: end function first (5 pts), prove that the algorithm correctly sorts the numbers in the array (in increasing order). after showing that it correctly sorts 1 and 2 element intervals, you may make the (incorrect) assumption that the number of elements being passed to g-sort-recurse is always a multiple of 3 to simplify the notation (and drop the floors/ceilings).
Answers: 3
question
Computers and Technology, 23.06.2019 13:10
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 13:20
In the insert table dialog box, you select the checkbox to create the first row as the header of the table.
Answers: 3
You know the right answer?
Ok, this is for computer science we’re suppose to make a program that takes a user input and the use...
Questions
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Spanish, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Physics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Social Studies, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
English, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
Questions on the website: 13722360