From 4c2ef9eef22dc7840a313c80f627012ac22f895c Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Sat, 30 Jul 2022 02:22:01 +0100 Subject: [PATCH] PrinAndMiss --- subjects/printandmiss/README.md | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 subjects/printandmiss/README.md diff --git a/subjects/printandmiss/README.md b/subjects/printandmiss/README.md new file mode 100644 index 00000000..97d1821f --- /dev/null +++ b/subjects/printandmiss/README.md @@ -0,0 +1,44 @@ +# PrintAndMiss + +### Instructions + +Write a function called `PrintAndMiss()` that takes a string and an integer and prints a string containing the characters until reaching the integer, then skipping that same number of characters, and repeats until the end of the string. + +- Prints the first half followed by newline `\n`. +- if the string is empty retun `Invalid Output`. + + +### Expected function + +```go +func PrintAndMiss(arg string, loop int) string { +} +``` +### Usage + +Here is a possible program to test your function: + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.PrintAndMiss("123456789", 3) + fmt.PrintAndMiss("abcdefghijklmnopqrstuvwyz", 3) + fmt.PrintAndMiss("", 3) + fmt.PrintAndMiss("hello you all ! ", 2) +} +``` + +And its output : + +```go +$ go run . | cat -e +123789$ +abcghimnostuz$ +Invalid Output$ +heo u ll $ +``` \ No newline at end of file