Write a function that takes two strings, s1 and s2, and prints all letters that appear in s1 but not in s2.
Define a function, less_than_n(word, n), that returns True if word has less than n letters, False otherwise.
Define a function that takes a string and returns True if its first character is 'b'.
Write a function that takes a string and prints only uppercase letters.
Example:
>>> print_uppercases("iAnai B")
A
B
Write a function that takes one string, and returns True if "a" appears in the string. It returns False otherwise.
Write a function, are_equal, that takes two values and returns True if they are equal, or False otherwise.
Write a function, is_less, that takes two values and returns True if the first is less than the second, or False otherwise.
Write a function, add, that takes two numbers and returns their sum.
Write a function, get_length, that takes a string and returns its length.
Write a function, char_after_target, that takes a word and a character,
word and target, and returns the character after target. If target is last, return
the first letter. If target is not found in word return None. Example:
>>> char_after_target("kastravec", "s")
"t"
>>> char_after_target("kastravec", "c")
"k"
>>> char_after_target("kastravec", "d")
None
Restrictions:
- You cannot use any relational operator(==, <, ...)
- You cannot use len
- You cannot use + or -
def is_char(word, ch, i):
return word[i] == ch
Given the above script, what are the results of the following expressions:
| is_char("llukar", "u", 2): | ||
| is_char("xerxe", "x", 3): | ||
| is_char("carralluke", "r", 3): |
def is_char(word, ch, i):
return word[i] == ch
Given the above script, what are the results of the following expressions:
| is_char("llukar", "u", 3): | ||
| is_char("xerxe", "x", 0): | ||
| is_char("carralluke", "c", 1): |
Complete execution flow of the following program
def print_numbers(s): for item in s: if item in '0123456789': print(item) print_numbers('a1e2')
Complete execution flow of the following program
def return_char(s, n): return s[n] return_char('llapushnik', 4) return_char('llaushe', 2 + 4)