Integer parameter and returns the total

Assignment Help Basic Computer Science
Reference no: EM131716571

Python 3 code needed:

Create a function called sumTo which takes an integer parameter and returns the total of all of the numbers from 1 to that number. For example, if the user entered a 5, the function would calculate 1 + 2 + 3 + 4 + 5 = 15. Keep prompting the user for a number until a zero (0) is entered. Use the following run as an example:

Enter a number: 5 sums to 15

Enter a number: 25 sums to 325

Enter a number: 100 sums to 5050

Enter a number: 0

Reference no: EM131716571

Questions Cloud

Prompt the user for two integers : Prompt the user for two integers. Using a loop, multiply the first number by the second number using only addition. For example:
Which parties have influence in the healthcare system : What is a stakeholder analysis and how will this be helpful in understanding which parties have influence in the healthcare system?
Reflect on horace miners famous article on the nacirema : Reflect on Horace Miner's famous article on the Nacirema and think about cultural beliefs and practices.
Determining the programming essentials : Your program for keeping track of team members is coming along, but now you want to be able to include phone numbers and jersey numbers.
Integer parameter and returns the total : Create a function called sumTo which takes an integer parameter and returns the total of all of the numbers from 1 to that number.
Avoid redundancy and avoid empty phrases : Identify three writing principles that you most need to work on. use short sentences in most cases; avoid redundancy; avoid empty phrases;
Create a homogenous global culture : Are we Americanizing other countries by exporting cultural products such as McDonald's? Would such cultural leveling be a good or a bad thing?
Calculating the square of every number : Ask the user for a number between 2 and 1000. Using a loop, calculate the integer square root by calculating the square of every number
Discuss conversations with your teenagers about sex : Consider the conversations that you would have with your teenagers about sex, if you were to have children.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Group policy on windows servers

1. What are some of the advantages of using Group Policy? What are some of the things that can be managed with it?

  Consequences of designing a system

What are the short term and long term consequences of designing a system with contract-to-logic coupling? What are the effects on the service itself and what are the effects on the overall service inventory when this occurs?

  Discuss some of the emerging trends in information

discuss some of the emerging trends in information technology e.g. computer hardware software data analysis. what

  Write a shell script named grepdir

Write a shell script, named grepdir.sh, that searches for a pattern in a directory, and all of its subdirectories.The starting directory is the first argument, the pattern is the second parameter, and the options for grep are all succeeding paramet..

  Calculate the electric field strength

Given that a half-wave dipole has a gain of 2.14 dBi, calculate the electric field strength at a distance of 10 km in free space in the direction of maximum radiation from a half-wave dipole that is fed, by means of lossless, matched line, by a 15..

  Illustrate the impact of successful leadership

Facebook be MySpace. The FACEBOOK versus My Space is an excellent comparison that illustrate the impact of successful leadership

  Describe the representation of the transition matrix

Consider a Web graph that is a chain, like Fig. 5.9, with n nodes. As a function of k, which you may assume divides n, describe the representation of the transition matrix for this graph, using the method of Section 5.2.4

  What steps would karina take to validate and globalize

What steps would Karina take to validate and globalize the website?

  Describe the extension of f provided by 2d fourier transform

In Section 10.4.1 the even 2D signal f seen by the cosine transform was described in a visual or geometric fashion. Describe the extension of f provided by the 2D Fourier transform.

  Determining the nosql databases

NOSQL databases in your work environment/school environment In this forum, describe your current organization or school (industry, size, processes, etc...) and discuss whether/how it could take advantage of NOSQL databases.

  What new optimizations are now possible

On the assumption that n will always be even, unroll inner loops once each. What new optimizations are now possible?

  Interface receives superior bpdu packets

What is the name of the security feature on a Cisco switch that will place a postfast interface into root-inconsistent state as long as that interface receives.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd