Skip to content

Instantly share code, notes, and snippets.

View RaMSFT's full-sized avatar

RaMS Nelluri RaMSFT

View GitHub Profile
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)
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)
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
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}"
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)
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:
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
"""
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
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
"""
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_