Skip to content

abdurashidov571/string_slicing_homework

 
 

Repository files navigation

Welcome

String Slicing

Automated grading of homework assignments and tests

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

Problems

Slicing01

The s string variable is given. return the four characters from the beginning.

Example 1:

Input: a="codeschooluz"
Output: "code"

Example 2:

Input: a="code"
Output: "code"

Constraints:

  • 4 <= length(a) <= 10^5

Slicing02

The s string variable is given. return four characters from the end.

Example 1:

Input: a="codeschooluz"
Output: "oluz"

Example 2:

Input: a="python"
Output: "thon"

Constraints:

  • 4 <= length(a) <= 10^5

Slicing03

The s string variable is given. Return all characters except the one at the beginning and end.

Example 1:

Input: a="hello"
Output: "ell"

Example 2:

Input: a="positive"
Output: "ositiv"

Constraints:

  • 2 <= length(a) <= 10^5

Slicing03

The s string variable is given. Return all characters except the one at the beginning and end.

Example 1:

Input: a="hello"
Output: "ell"

Example 2:

Input: a="positive"
Output: "ositiv"

Constraints:

  • 2 <= length(a) <= 10^5

Slicing04

The s string variable is given. return n characters from the beginning.

Example 1:

Input: a="negative", n=2
Output: "ne"

Example 2:

Input: a="positive" n=2
Output: "po"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing05

The s string variable is given. return n characters from the end.

Example 1:

Input: a="codeschooluz", n=3
Output: "luz"

Example 2:

Input: a="positive" n=1
Output: "e"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing06

The s string variable is given. return all characters except n characters from the beginning.

Example 1:

Input: a="codeschooluz", n=3
Output: "eschooluz"

Example 2:

Input: a="apple" n=1
Output: "pple"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing07

The s string variable is given. return all characters except n characters at the end.

Example 1:

Input: a="codeschooluz", n=3
Output: "codeschoo"

Example 2:

Input: a="apple" n=1
Output: "appl"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing08

The s string variable is given. return the characters in the odd position.

Example 1:

Input: a="codeschooluz"
Output: "oecolz"

Example 2:

Input: a="apple"
Output: "pl"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing09

The s string variable is given. return the characters in the even position.

Example 1:

Input: a="codeschooluz"
Output: "cdshou"

Example 2:

Input: a="apple"
Output: "ape"

Constraints:

  • 2 <= length(a) <= 10^5
  • 1 <= n <= length(a)

Slicing10

The s string variable is given. return from index n to index k.

Example 1:

Input: a="codeschooluz" n=2 k=5
Output: "des"

Example 2:

Input: a="apple" n=2 k=2
Output: "p"

Constraints:

  • 2 <= length(a) <= 10^5
  • 0 <= n <= length(a)
  • n <= k <= length(a)

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

  • Python 100.0%