All Tracks/lab number pattern generator/
Đang tải...
Hướng dẫn thử thách
1 / 1

Build a Number Pattern Generator

In this lab you will practice the basics of Python by building a small app that creates a number pattern. **Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab. **User Stories:** 1. You should define a function named `number_pattern` that takes a single parameter `n` (representing a positive integer). 1. `number_pattern` should use a `for` loop. 1. `number_pattern(n)` should return a string with all the integers starting from 1 up to `n` (included) separated by a space. For example, `number_pattern(4)` should return the string `1 2 3 4`. 1. If the argument passed to the function is not an integer value, the function should return `Argument must be an integer value.` 1. If the argument passed to the function is less than 1, the function should return `Argument must be an integer greater than 0.`
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.py
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.