This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def convert_hr_min_to_sec(hours, minutes): | |
| """Convert hour and minutes to seconds | |
| Args: | |
| hours (integer): number of hours | |
| minutes (integer): number of seconds | |
| Returns: | |
| integer: resturn number of second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def positive_negative_number(num): | |
| """Return if a number positive or negative | |
| Args: | |
| num (numeric): number to check if it is + / - | |
| Returns: | |
| String: text positive / negative number | |
| """ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def generate_random(min, max): | |
| """Generate a random number between given integers min and max | |
| Args: | |
| min (integer): min value | |
| max (integer): max value | |
| Returns: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bool_to_string(flag): | |
| """Convert a boolean value to a string | |
| Args: | |
| flag (boolean): boolean value to convert into string | |
| Returns: | |
| string: boolean to string result | |
| """ | |
| return str(flag) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def greet_someone(): | |
| """Functions asks for user name interactively and returns the greeting | |
| Returns: | |
| String: returns the greeting | |
| """ | |
| name = input("What is your Name: ") | |
| return f"Hello, {name}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_smallest_num_using_for(lst): | |
| """Find the smallest number from the list using for loop | |
| Args: | |
| lst (Numeric): a list of numbers | |
| Returns: | |
| Numeric: return the smallest of all numbers in the list | |
| """ | |
| # Initiate a variable smallest with first element of list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_smallest_num(lst): | |
| """Find the smallest number from the list | |
| Args: | |
| lst (Numeric): a list of numbers | |
| Returns: | |
| Numeric: return the smallest of all numbers in the list | |
| """ | |
| return min(lst) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_largest_num(lst): | |
| """Find the smallest number from the list | |
| Args: | |
| lst (Numeric): a list of numbers | |
| Returns: | |
| Numeric: return the smallest of all numbers in the list | |
| """ | |
| return max(lst) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_largest_num_using_for(lst): | |
| """Find the largest number from the list using for loop | |
| Args: | |
| lst (Numeric): a list of numbers | |
| Returns: | |
| Numeric: return the largest of all numbers in the list | |
| """ | |
| # Initiate a variable largest with first element of list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def difference_max_min(lst): | |
| """Find the difference between largest and smallest numbers from a list | |
| Args: | |
| lst (numerics): a list of numbers | |
| Returns: | |
| number: difference between largest and smallest numbers of the list | |
| """ |