시작하기 전에
- 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
- 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
- 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured, object-oriented and functional programming.
You will learn about the Python recursion in this lab. Python recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, similar sub-problems. This process continues until a base case is reached, at which point the function starts returning values, and these returned values are combined to obtain the final result. Recursion is often used to solve problems that can be divided into smaller, identical sub-tasks, making the code more elegant and concise in certain situations.
Please go through these directions. The Labs have a time limit and cannot be paused. The timer begins when you click the Start Lab button, shows how long Google Cloud resources will be made available to you.
After you click the Start Lab button, you will see an editor and terminal, where you will be performing further steps in the lab. It should looks like this:
You are going to finish a series of tasks related to Python programming.
task as shown below. You will need to use these files to complete the tasks in the lab.To complete this lab, you need:
Fill in the blanks to make the is_power_of function return whether the number is a power of the given base.
Click the files icon to access the pre-created file.
Open the pre-created task1.py file, by clicking on the file name.
Replace the (___) with the missing code into the above function.
Execute the code by entering the following command in the terminal.
The count_users function recursively counts the amount of users that belong to a group in the company system, by going through each of the members of a group and if one of them is a group, recursively calling the function and counting the members. The following code has a bug!
Click the files icon to access the pre-created file.
Open the pre-created task2.py file, by clicking on the file name.
Write the following code at the location marked by the #TODO comment in the task2.py file.
Identify the bug on the above code and fix the problem.
Execute the code by entering the following command in the terminal.
Implement the sum_positive_numbers function, as a recursive function that returns the sum of all positive numbers between the number n received and 1.
For example - when n is 3 it should return 1+2+3=6, and when n is 5 it should return 1+2+3+4+5=15.
Click the files icon to access the pre-created file.
Open the pre-created task3.py file, by clicking on the file name.
Complete the above python code that returns the expected output.
Execute the code by entering the following command in the terminal.
You have successfully completed the tasks related to Python Programming.
현재 이 콘텐츠를 이용할 수 없습니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
감사합니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
한 번에 실습 1개만 가능
모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.