Ich studiere momentan Sportwissenschaften und muss dafür ein einzelnes Biologiemodul besuchen, bei welchem wir nun ebenfalls das Programmieren mit Python haben. Ich muss ehrlich gestehen, dass ich absolut keine Ahnung habe davon und mich auch überhaupt nicht dafür interessiere (werde es auch nie wieder gebrauchen). Ich muss jedoch dieses Modul bestehen, um meinen Masterabschluss in Sportwissenschaften zu erhalten.
Meine Frage ist nun, ob mir jemand bei den angehängten Fragen helfen könnte?! Ich bräuchte eine genaue Anleitung, was ich eingeben muss
Ich denke, dass dies für die Meisten absolut Peanuts ist, ich jedoch, verstehe leider nur Bahnhof.
Ich danke euch bereits im Voraus für eure Hilfe!!!!
Übungen:
1. Read an integer from the command line (hint: input()funtion). Double the number and if it is positive. Halve the number if it is negative. Print the result.
2. Define a list of at least ten strings. Print every second string.
3. Read numbers from the command line. Add them up until 0 is entered. Afterwards print the sum.
4. Read numbers from the command line. Sum them up if they are positive, ignore them if they are negative and stop when 0 is entered. Use continue and break!
5. Write a function which returns the absolute difference between two numbers a and b: I a - B I. Call the function for five combinations for a and b.
Try do solve at least one of the following, if you can (yes, they are a bit tougher!):
- Write a function that computers and returns the factorial of any positive integer. Use either a 'for' loop, a 'while' loop, or recursion. Call the function for 13 and print the returned factorial to the console.
- Write a function that decomposes andy positive integer into its prime factors and returns them as a list. Call the function for 12341234 and print the list of prime factors to the console.
