In Python (and make it a function, with sample input, output):
In Python (and make it a function, with sample input, output): Write map function from scratch,...
PYTHON Programming short Questions: 1. Write a function takes as input name (string) and age (number) and prints: My name is <name> and I am <age> years old(where name and age are the inputs) 2. Write a function that takes as input a and b and returns the result of: ??ab 3. Write a function that takes as input a and b and returns the result of: ??ab if it is valid to divide a and b 4. Write a...
Function 4: my-map In CLISP define your own function that duplicates the functionality of mapcar from the standard library. You may not use the built-in mapcar function as a helper function. Your implementation must be recursive. · Input: The input to my-map is a function that takes a single argument and a homogeneous list of elements of the same data type compatible with the procedure. Note: the function argument can be named or anonymous (lambda). · Output: A new list...
3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...
I need help writing this function in python. Write a function that takes, as input and returns a dictionary where each string in L is a key and the vowels of the string are values. This function is called def dictVowel(L). sample input is ["one", "two", "three"] output will be {"one": "oe", "two": "o", "three": "ee"}
Write a Python program with a function that will take as input from the user the temperature in Celsius and will convert and display temperature values in both Fahrenheit and Celsius, using the equation: F = (C ∗ 9/5)+ 32 Note: below is what a sample input line to your program should look like and the resulting output. User input lines always start with >>>. This convention will be used for all of the problem sets. >>>Enter temperature in Celsius:...
Write a Python function that will take a string and a list as its only parameters. The function needs to return a new string that is the original string with all of the characters appearing in the list parameter replaced with an asterisk(*). The returned string needs to have the remaining characters appear in the same location as the characters they replaced. Hint/Reminder: Note you can make a string out of characters optimally without repeatedly using the concatenation operator.
Python 3, nbgrader, pandas 0.23.4
Q2 Default Value Functions (1 point) a) Sort Keys Write a function called sort_keys, which will return a sorted version of the keys from an input dictionary Input(s): dictionary :dictionary reverse boolean, default: False Output(s): .sorted_keys: list Procedure(s) Get the keys from the input dictionary using the keys()method (this will return a list of keys) Use the sorted function to sort the list of keys. Pass in reverse to sorted to set whether to reverse...
Lab 1 Q1. Write a Python program with the following function building block. •All input values are to be taken fro m the user. •Ensure to check for possible error cases like mismatch of data type and input out of range, for every function. Function 1: countVowels(sentence) – Function that returns the count of vowels in a sentence. Function 2: Sum of all even numbers between two numbers, identify number of parameters Q2. Write a Python program that reads a...
On Python 3.6, write a function char_table(s), where s is a string. The function should produce a table that shows the characters in the string and the number of occurrences of each character. Make the table nicely formatted, using right justification for the numbers (check out the format command.). List the characters in order (the order in the character encoding). Give some examples of the output.
Write a Python file containing the following functions. Also turn in the output from testing the functions. All arguments to the functions may be hard-coded. Function 1 takes a list of strings as a parameter and returns a list of strings consisting of all the strings in the original list that have identical consecutive letters. For example: fun1 ([llama, good, cat, abba, abab, 112, dog]) returns [llama, good, abba, 112] Function 2 takes an integer (n), representing the number of...