Python string method replace() returns a copy of the string in which the occurrences of old have been replaced with new, optionally restricting the number of replacements to max. | |
Python string method split() returns a list of all the words in the string, using str as the separator (splits on all whitespace if left unspecified), optionally limiting the number of splits to num. |
# Solution #1: Using while loop
# Solution #2: Using range(start, end, step)
# Solution #1: Using while loop
# Solution #2: Using range(start, end, step)
Write a function that takes three integer parameters, return the biggest.
# Return the biggest number
def biggest_number(num1, num2, num3):
# Given a string
string = 'Python is a powerful programming language'
# Check if 'is' prsents in the string
def if_presents(substring):
Check if ‘me’ not presents in the string
# Given a function `replace(target, value)` and a string
string = 'Hello Python'
# Write a function to return 'Hello World'
def replace_string(string):
# Return the substring of the given string
string = 'Hello Python'
def return_substring(string):
# Return 'Hello P'
return_substring(string)
# Given a string
string = '10,20,30,40,50,60,70'
# Return '40,50'
def return_certain_values(string):
Homework
Write two functions one of which reverse the given string, another will check if the first string is reverse of the second string:
For Example:
# Reverse the given string
def reverse_string(string):
# CHeck if the first string is reverse of the second string
# Return True of False
def reverse_check(string1, string2):