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_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_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 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 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
| 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 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
| 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 is_same_num(num1, num2): | |
| """Check if given two numbers are equal | |
| Args: | |
| num1 (numeric): input numebr one | |
| num2 (numeric): input number two | |
| Returns: | |
| Boolean: Rteurn True when both numbers are same, else False | |
| """ |
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 calculate_points(wins, draws, losses): | |
| """calculate points for a football match based on wins, losses, and draws | |
| Args: | |
| wins (integer): number of wins | |
| draws (integer): number of draws | |
| losses (integer): number of losses | |
| Returns: | |
| _type_: _description_ |