This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.14" | |
| # dependencies = [ | |
| # "openai>=2.35.1", | |
| # ] | |
| # /// | |
| from openai import OpenAI | |
| import base64 | |
| import os |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2019, the Dart project authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license. | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person { | |
| String name; | |
| DateTime birthDate; | |
| int _weight; | |
| Person({this.name, this.birthDate}); | |
| int get age { | |
| // This is an arbitrary calculation. | |
| // See https://leechy.dev/calculate-dates-diff-in-dart for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:math'; | |
| class Point { | |
| int x; | |
| int y; | |
| Point(x, y) | |
| : x = x, | |
| y = y; | |
| // Point.origin() : x = 0, y = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Vehicle { | |
| final String color; | |
| final int wheel; | |
| final int maxSpeed; | |
| int _currentSpeed = 0; | |
| Vehicle(this.color, this.wheel, this.maxSpeed); | |
| @override | |
| String toString() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| // var testNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
| var testNumbers = [for (var i = 0; i <= 10; i++) i]; | |
| print('Test set: $testNumbers'); | |
| testNumbers.forEach((number) => print('fibonacci($number) = ${fibonacci(number)}')); | |
| } | |
| int fibonacci(int n) { | |
| // Add your code here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| // var testNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
| var testNumbers = [for (var i = 0; i <= 10; i++) i]; | |
| print('Test set: $testNumbers'); | |
| testNumbers | |
| .forEach((number) => print('fibonacci($number) = ${fibonacci(number)}')); | |
| } | |
| int fibonacci(int n) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String currentPlayerName; | |
| void main() { | |
| var signInName = 'Kevin'; | |
| // Convert this code statement by using Null-aware operator | |
| if (signInName != null) { | |
| currentPlayerName = signInName; | |
| } else { | |
| currentPlayerName = 'Guest'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| final a = 30; | |
| final b = 400; | |
| int max; | |
| // เปลี่ยน statement นี้ให้เป็น conditional expression โดยใช้ ternary operator (? : ) | |
| if (a > b) { | |
| max = a; | |
| } else { |
NewerOlder