Functions part 2 in python by CodingXpertz

Veröffentlicht am: 01 Januar 1970
auf dem Kanal: Coding Xpertz
26
2

In this video I’ll show you how to return and receive multiple values. We’ll also calculate primes,
calculate areas for different shapes and talk about main().
To return multiple values just separate values returned with commas.
CODE
def mult_divide(num1, num2):
return (num1 * num2), (num1 / num2)


mult, divide = mult_divide(5, 4)


print("5 * 4 =", mult)
print("5 / 4 =", divide)
Return a List of Primes
A prime can only be divided by 1 and itself. 5 is prime because 1 and 5 are its only positive
factors. 6 is a composite because it is divisible by 1, 2, 3 and 6.


We'll receive a request for primes up to the input value. We’ll then use a for loop and check if
modulus == 0 for every value up to the number to check. If modulus == 0 that means the
number isn't prime


Auf dieser Seite können Sie das Online-Video Functions part 2 in python by CodingXpertz mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Coding Xpertz 01 Januar 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 26 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!