Skip to content

Python-2022-online/for_loop_homework

Repository files navigation

Welcome

For LOOP

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message

Problems

For01

Return numbers from zero to n in a list view.

Example 1:

Input: n = 5
Output: [0, 1, 2, 3, 4]

Constraints:

  • 1 <= n <= 10^9

For02

Return numbers from zero to n in a string view.

Example 1:

Input: n = 3
Output: "0,1,2"

Constraints:

  • 1 <= n <= 10^9

For03

Repeat the number k n times and return to the list view.

Example 1:

Input: k = 5 n = 3
Output: [5, 5, 5]

Example 3:

Input: k = -1 n = 4
Output: [-1, -1, -1, -1]

Constraints:

  • 1 <= n <= 10^9
  • -10^9 <= k <= 10^9

For04

Return the numbers from A to B in the form of a list.

Example 1:

Input: A = 2 B = 7
Output: [2, 3, 4, 5, 6, 7]

Constraints:

  • -10^9 <= A <= 10^9
  • A <= B <= 10^9

For05

Return the numbers from B to A in the form of a list.

Example 1:

Input: A = 5 B = 9
Output: [9, 8, 7, 6, 5]

Constraints:

  • -10^9 <= A <= 10^9
  • A <= B <= 10^9

For06

Return the sum of all integers from A to B.

Example 1:

Input: A = 3 B = 6
Output: 12

Example 2:

Input: A = -6 B = 8
Output: 7

Constraints:

  • -10^9 <= A <= 10^9
  • A <= B <= 10^9

For07

Return the sum of odd numbers from zero to N.

Example 1:

Input: N = 12
Output: 36

Constraints:

  • 0 <= N <= 10^9

For08

The number N is given. Calculate the sum below: 1 + 1/2 + 1/3 + … + 1/N.

Example 1:

Input: N = 4
Output: 2.083333333333333

Constraints:

  • 0 <= N <= 10^9

For09

The price of a kilogram of sweets is given. Return the price of a dessert from one to ten kg in the form of a list.

Example 1:

Input: price = 2.25
Output: [2.25, 4.5, 6.75, 9.0, 11.25, 13.5, 15.75, 18.0, 20.25, 22.5]

Constraints:

  • 0 <= price <= 10^9

For10

Returns a list where only the first letter of each name is capitalized.

Example 1:

Input: list1 = ['rustam', 'diyor', 'alisher', 'bektosh']
Output: ['Rustam', 'Diyor', 'Alisher', 'Bektosh']

Warning

  • don't copy other solutions or any solution
  • don't remove comments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages