USING PYTHON
Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument.
Include all of the following in your Learning Journal:
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
Note: Brother sometimes while uploading on HomeworkLib the indentations change. So, I request you to verify it with screenshot once. This is the link where I have saved the code too
https://onlinegdb.com/B1o6wxvxB
def func(s):
# Calling reverse function
rev = s[::-1]
# Checking if both string are equal or not
if (s == rev):
return True
return False
#Three function calls and their output
print(func("HEH")); #OUTPUT IS True
print(func("HELL")); #OUTPUT IS False
print(func("a")); #OUTPUT IS True

The function basically checks if the given string is a palindrome or not by reversing the string and matching it with original string. If palindrome then it will return true else will return false
Kindly revert for any queries
Thanks.
USING PYTHON Write your own function that illustrates a feature that you learned in this unit....
Please help, using Python Write a Python function sum_of_4th_powers, which accepts one argument. You can assume that the function is only called with an integer n as argument, i.e., no need to worry about invalid inputs. If the argument n can be written as a sum n=a4+b4+c4 with all of a,b,c being non-zero, your function should return such a decomposition. Otherwise your function must return False. For example: sum_of_4th_powers(5) must return False, sum_of_4th_powers(18) could return (1,1,2). *Please go step by...
Using python, Write a function max3 that takes three numbers as its arguments and returns the greatest of these three numbers. Your submitted file for this problem should include (a) function definition, obviously, and (b) the code that calls that function (for this problem you do not have to package that calling code into the main() function although you may if you want to), so that if I run your *.py file it computes and prints something (e.g. few test...
Python Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following: How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. How to format each item of your inverted dictionary as a text string in the output file. Create an input file with your original...
Write a Python function, called counting, that takes two arguments (a string and an integer), and returns the number of digits in the string argument that are not the same as the integer argument. Include a main function that inputs the two values (string and integer) and outputs the result, with appropriate labelling. You are not permitted to use the Python string methods (such as count(), etc.). Sample input/output: Please enter a string of digits: 34598205 Please enter a 1-digit...
Python 3: Write a function CharCount, to take a string S and a single character C, and returns the count of C (one letter) in the string S. If the letter of C is not found in S, the function returns -1. You must write your own function to do this and can not use any built-in counting functions. Use the function in main to get two inputs from the user, a sentence and a character, then show the count...
6.5.1: Functions: Factoring out a unit-conversion
calculation.PYTHON CODINGWrite a function so that the main program below can be replaced
by the simpler code that calls function mph_and_minutes_to_miles().
Original main program:miles_per_hour = float(input())
minutes_traveled = float(input())
hours_traveled = minutes_traveled / 60.0
miles_traveled = hours_traveled * miles_per_hour
print('Miles: %f' % miles_traveled)Sample output with inputs: 70.0 100.0Miles: 116.666667
Exercise 1.1 from your textbook recommends that you try to make mistakes when experimenting with a new programming feature. This kind of experiment helps you remember what you read; it also helps when you are programming, because you get to know what the error messages mean. It is better to make mistakes now and on purpose than later and accidentally. (Downey, 2015, 7) For this Learning Journal, first answer the following questions based on Exercise 1.1. If you are trying...
1. Write a Python function to count how many python function definitions in a given Python program. 2. Write a Python function to return the number of word wrapped lines of given number of characters in a given text file. Inside your function you must do it in a single line of code except docstring and comments.
PYTHON
The first function you will write should be called ‘countDown’.
Your function should take zero (0) arguments. The function should
return one (1) list containing integers from 10 to 1 and finally,
the string “Liftoff!”. (i.e., [10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
‘Liftoff!’]). You function must be recursive (i.e., it should
contain a call to itself within the function body). You will get NO
credit if you use any loops (for, while, etc).
3. Function...
Write a function in Python called addressesthat will take an address value as parameter and print it as a binary number, a hex number, and an integer decimal number on three separate lines. Include your code and evidence that it works in your homework submission. [Hint: The Python interpreter has a number of functions and types built intothe language that are always available. A few of these might be useful ;) Google: Python built-in functions.] You can use whichever Python...