Skip to content

CatenaScientiarum/SummerPractice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SummerPracttice

This repository contains solutions to five Python programming tasks.

The tasks are.

  1. Backward String

Description: Return a string in reverse order.

Input format:

  • String.

Output data format:

  • String.

Examples: assert backward_string("val") == "lav" assert backward_string("12") == "21" assert backward_string("ohho") == "ohho" assert backward_string("123456789") == "987654321"

  1. Just Fizz! Description: Write a function that takes a positive integer and returns: "Fizz", if the number is a multiple of 3 (3, 6, 9 ...), otherwise it converts this number to a string (2 -> "2").

Input format:

Integer. Output format:

String. Examples:

assert checkio(15) == "Fizz" assert checkio(6) == "Fizz" assert checkio(10) == "10" assert checkio(7) == "7"

  1. First Word (simplified) Description: Given a text and you need to find its first word. The text contains English letters and spaces. There are no spaces at the beginning and at the end.

Input format:

String. Output format:

String. Examples:

assert first_word("Hello world") == "Hello" assert first_word("a word") == "a" assert first_word("greeting from Ukraine") == "greeting" assert first_word("hi") == "hi"

  1. Rectangle Perimeter Description: Calculate the perimeter of a rectangle given the length and width.

Input format:

Two integers (length and width). Output format:

An integer (perimeter). Examples: print(rectangle_perimeter(3, 2)) # 10 assert rectangle_perimeter(2, 4) == 12 assert rectangle_perimeter(3, 5) == 16 assert rectangle_perimeter(10, 20) == 60 assert rectangle_perimeter(7, 2) == 18

  1. Integer Sign Determination Description: Determine if the given integer is positive, negative or zero.

Input format:

Integer. Output format:

String. Examples:

assert determine_sign(5) == "positive" assert determine_sign(0) == "zero" assert determine_sign(-10) == "negative"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages