All generations.

generate functionSat, 01 Apr 2023

implementing real-time/technical applications using lists, tuples (word count, longest number)

#Write a Python function to find the Max of three numbers. def max_of_two( x, y ): if x > y: return x return y def max_of_three( x, y, z ): return max_of_two( x, max_of_two( y, z ) ) print(max_of_three(5, 4, 12)) #Write a Python function to sum all the numbers in a list. def sum(numbers): total = 0 for x in numbers: total += x return total print(sum((1, 2, 3, 4, 5, 6))) #Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. def string_test(s): d={"UPPER_CASE":0, "LOWER_CASE":0} for c in s: if c.isupper(): d["UPPER_CASE"]+=1 elif c.islower(): d["LOWER_

Python
View

Questions about programming?Chat with your personal AI assistant