# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12169 | Hello World in Python |
|
13175 | Print multiple times |
|
13838 | Modify a string |
|
Description
Given a specific text, you need to print out it with Python code!
Input
A line of text
Output
There are two lines for output, which are
1. The original given text above
2. Adding text "Hello~" before the given text and "!" after the given text
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a specific line of text including text and operators, you need to print out the text and the operator for a multiple times.
Input
There's a line of text with the following syntax:
e1,e2,e3
Note that:
1. Each element is separated by a ',' token.
2. e1, e2 ,e3 represented 3 elements from given text.
Output
A line of text with the following operations:
e1: Representing the number of times of e2 needed to be printed.
e2: Representing the word that needs to be printed.
e3: Representing the operator that separates each of the word e2, and it should also exist in the beginning and in the end.
For example, the output would be like this:
e3e2e3e2......e3e2e3 <--- e2 exists e1 times.
Note that:
1. There will be no connection elements between e2 and e3 for your output.
2. There will be a new line default by python's print()
function. If you are using python's print()
, just ignore this point.
3. You can use split()
function to separate the elements from one string.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
This is Advanced Question for HW1.
Write a program that takes a string as input and outputs a modified version of the string, according to the following rules:
If the length of the string is odd, reverse the string and capitalize the first letter.
If the length of the string is even, replace the middle two characters with the characters "42".
Note that, in Python Language, you can use the function len()
to get the number of characters of a string. (Whitespace also counts in the length of string)
Input
A string of characters on a single line.
Output
The modified version of the input string, according to the above rules.