Recap - Dynamic Input
Part of the Fundamentals section of Coddy's Python journey — lesson 42 of 77.
Challenge
BeginnerWrite a program that gets a dynamic number of input values.
The first input tells you how many numbers will follow. The next inputs are whole numbers that you need to sum.
In the end, print the sum of all the input numbers (not including the first input).
For example,
Input:
3
1
5
6Expected output: 12
Explanation:
1 + 5 + 6 = 12, and there are exactly 3 numbers following the first input number (3).
Try it yourself
All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 48Loops
For LoopWhile LoopBreakContinueRecap - FactorialThe Range FunctionNested LoopRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionRecap - Validation FunctionDefault Values12Iterating Over Sequences
Iterating Over ElementsThe Enumerate FunctionIterating Over Strings Part 1Iterating Over Strings Part 2