首页 > 编程语言 >AI Python for Beginners-Andrew吴恩达-study notes(2)

AI Python for Beginners-Andrew吴恩达-study notes(2)

时间:2024-08-11 22:58:58浏览次数:33  
标签:吴恩达 task AI study list use isabel ###

1 Introduction

        it is believed that with the help of AI chatbot we can learn python more easily and it will be amazing to automate tasks using Python

2  Completing a task list with AI

2.1 List

①list is a single variable of type that holds multiple values

②len() will show how many values are stored in the list

③you can access any element by choose the right index number

④ you can add/remove another element into it by using append()/remove()

3 Repeating tasks with for loops

Let's break this down.

The for task in list pattern works as follows:

  • task is assigned the first item in the list. In this case, it's the string "Compose a brief email to my boss explaining that I will be late for tomorrow's meeting."
  • The next indented line is called a block and contains an action to carry out on task. In this example, the string gets passed to the LLM, and the result appears on the screen.
  • Then the loop starts again. Now, task is assigned the string "Write a birthday poem for Otto, celebrating his 28th birthday." It's the same variable, but with a different value.
  • get_llm_response runs again, and so on.

Be sure to call out the : at the end of the line. Indentation is crucial; if it’s not correct, you'll get an error.

③there will be different if the codes do not be indented one level

P.S.if there is a list with 5 values and I want to print the first three values and there is no interspace between the result printed ,can I use for loops?

4 Prioritizing tasks with dictionaries and AI

4.1 Dictionaries

①to access the values in the dictionary you need to use its keys or you can use values() to see all of it.

② to add a new item for the "Rocky Road" flavor, you will need to assign its definition to ice_cream_flavors["Rocky Road"] as follows:(You can update existing dictionary items in a similar way)

③it is okey that you store different types of elements or lists in dictionary

④ a example with the use of list and dictionary

5 Customizing recipes with lists,dictionaries and AI

        it is more about using the previous knowledge to get a recipe for yourself

https://learn.deeplearning.ai/courses/ai-python-for-beginners-c2/lesson/5/customizing-recipes-with-lists,-dictionaries-and-ai

6 Comparing data in Python

6.1 boolean

①it is okey to use boolean valuse in dictionary

6.2 Comparison Operators

# Assume ages are given
isabel_age = 25
tommy_age = 22
daniel_age = 27

### EDITED CODE ###
is_isabel_older_than_tommy = isabel_age > tommy_age
is_isabel_older_than_daniel = isabel_age > daniel_age
### --------------- ###

### EDITED CODE ###
# Using the logical operator "or" to check if Isabel is older than at least one friend
print("Check if Isabel is older than at least one of my friends:", is_isabel_older_than_tommy or is_isabel_older_than_daniel)
### --------------- ###

7 Helping AI make decisions

from helper_functions import print_llm_response

task_list = [
    {
        "description": "Compose a brief email to my boss explaining that I will be late for next week's meeting.",
        "time_to_complete": 3
    },
    {
        "description": "Create an outline for a presentation on the benefits of remote work.",
        "time_to_complete": 60
    },
    {
        "description": "Write a 300-word review of the movie 'The Arrival'.",
        "time_to_complete": 30
    },
    {
        "description": "Create a shopping list for tofu and olive stir fry.",
        "time_to_complete": 5
    }
]

task = task_list[0]
print(task)

task["time_to_complete"] <= 5 

if task["time_to_complete"] <= 5:
    task_to_do = task["description"]
    print_llm_response(task_to_do)

8 Next course preview:working with files

        try to use AI in python to highlight the data in files

from helper_functions import *

journal = read_journal("journal_entries/cape_town.txt") 
print(journal)

prompt = f"""
Given the following journal entry from a food critic, identify the restaurants and their specialties.
For each restaurant, highlight its name and specialties in bold and use different colors for each.
Provide the output as HTML suitable for display in a Jupyter notebook.

Journal entry:
{journal}
"""
html_response = get_llm_response(prompt)
display_html(html_response)

学习网站:

https://learn.deeplearning.ai/courses/ai-python-for-beginners-c2/lesson/1/introduction

标签:吴恩达,task,AI,study,list,use,isabel,###
From: https://blog.csdn.net/2302_77608969/article/details/141110964

相关文章

  • LangChain 安全特性全解析与实践指南
    LangChain安全特性全解析与实践指南引言在人工智能的浪潮中,LangChain以其卓越的能力,成为开发大型语言模型(LLM)应用程序的佼佼者。然而,随着技术的发展,安全问题逐渐浮出水面。本文将深入探讨LangChain的安全特性,并提供详细的代码示例和最佳实践,以确保开发者能够在保障安全......
  • D - Square Pair
    原题链接题解多想几种暴力1.遍历所有数对:\(O(n^2)\)2.求有多少数对其乘积为平方数\(\to\)求有多少平方数能被数对乘积:\(O(n^2)\)3.如果两个数的乘积为平方数,代表他们的质因数,要么都是奇数,要么都是偶数:\(O(?)\)4.如果\(a\timesb\)是完全平方数,代表\(a\timesb\)......
  • 解密AI的未来:决策式AI与生成式AI的深度解析
    在当今科技飞速发展的时代,人工智能(AI)已成为各行各业的热议话题。尤其是决策式AI和生成式AI,这两种技术各具特色,却又相辅相成。本文将深入探讨这两种AI的定义、应用及其未来发展趋势,带你一探究竟!一、什么是决策式AI?决策式AI是指能够通过分析数据和信息,帮助用户做出明智决策的人......
  • 洛谷 P1560 [USACO5.2]蜗牛的旅行Snail Trails(c++)
    describe蜗牛在制定今天的旅游计划,有n个景点可选,它已经把这些景点按照顺路游览的顺序排成一排了,每个地方有相应的景观,这里用一个整数表示。蜗牛希望选取连续的一段景点,还要选出来的每一个景点的景观都不同,问它最多能选出多少个景点进行旅游。#include<iostream>#inc......
  • DataWhale-2024夏令营第四期-从零入门AI生图原理&实践-学习笔记
    DataWhale-2024夏令营第四期-从零入门AI生图原理&实践-学习笔记Datawhale(linklearner.com)学习链接AI生图基础知识一、文生图(Text-to-ImageGeneration)历史随着深度学习的发展,近些年来越来越多的AI生图效果通过大语言模型得到了一定的提升。文生图的历史:文生图的概念最......
  • Windows平台Hyper-V下使用iKuai作为主路由实现网口桥接
    Windows平台Hyper-V下使用iKuai作为主路由实现网口桥接问题背景在使用iKuai作为主路由时,可能会遇到后添加的虚拟端口下的设备无法联网的问题,这可能是iKuai的一个bug。解决方案以下是解决Windows平台Hyper-V下iKuai主路由网口桥接问题的步骤:确定主要网卡:观察并确定网桥使用的......
  • 解决pip无法更新问题的简单方法:WARNING: You are using pip version 20.2.1; however,
    用pip安装python应用的程序包时,也遇到了同样的问题,pip无法正常更新,因此就不能用pip下载安装程序包了。需要必须把pip更新到最新的状态后,才能使用pip的便捷功能。当时网上搜搜答案解决了,没有记录下来。今天使用pip使,又遇到了同样的问题,依然是网上一顿搜,试了各种方法,才成功安装好了......
  • 从英特尔错失AI机遇看未来生活的启示与行动指南
    题目:从英特尔错失AI机遇看未来生活的启示与行动指南引言在科技日新月异的今天,每一个决策都可能成为影响企业乃至整个行业走向的关键。英特尔错失投资OpenAI的机遇,不仅揭示了企业在面对新兴技术时的战略短视,也为我们的生活和工作带来了深刻的启示。本文旨在探讨这一事件背后的......
  • Datawhale X 魔搭 AI夏令营-AIGC文生图-task1-笔记
    目录1赛题解读2文生图的历史3文生图基础知识介绍3.1提示词3.2 Lora3.3 ComfyUI3.4 参考图控制4实践-通过代码完成模型微调&AI生图-Test4.1 体验baseline4.2上传至魔搭社区4.3尝试baseline-改了prompt很幸运能够发现这样一个宝藏!“从零入门AI生图原......
  • Windows ,elasticsearch 启动报错 failed to obtain node locks
    报错:2024.08.1118:14:45ERRORes[][o.e.b.ElasticsearchUncaughtExceptionHandler]uncaughtexceptioninthread[main]org.elasticsearch.bootstrap.StartupException:java.lang.IllegalStateException:failedtoobtainnodelocks,tried[[D:\soft\Java\sonarq......