袖里吧 关注:4贴子:148

Introduction to Computer Science

只看楼主收藏回复



1楼2018-01-11 15:25回复
    Programming Languages Basics
    In order to make the computer to react in the way youwant,you need to give the computerinstructions in language the computer “understands”.
    But, the computer understands only one language: machine language.
    Machine language is in the form of ones and zeros.
    编程语言基础
    为了使计算机以你想要的方式作出反应,你需要给计算机“理解”的语言提供计算机指令。
    但是,电脑只懂一种语言:机器语言。
    机器语言以1和0的形式出现。


    2楼2018-01-11 15:31
    回复
      2025-06-28 03:00:22
      广告
      Programming Languages Basics
      Since it is highly impractical for people to create programs out
      of zeros and ones, programmers use a high-level programming language.
      For example: Python, C, C++, JAVA, etc.
      Higher-level languages allow computer programmers to write instructions in a format that is easier for humans to understand.
      编程语言基础
      由于人们用零和一创建程序是非常不切实际的
      ,程序员使用高级编程语言。
      例如:Python,C,C ++,JAVA等
      更高级的语言允许计算机程序员以便于人们理解的格式编写指令。


      3楼2018-01-11 15:33
      回复
        From High Level to Machine Level Languages
        No computer understands the high-level instruction directly,
        therefore it has to be transformedto the machine languages.
        The transformationfrom high level to machine level languages comes in two flavors: by interpreters, and by compilers.
        从高级到机器级语言
        没有电脑直接了解高级指令,
        因此必须转换成机器语言。
        从高级到机器级语言的转换有两种:解释器和编译器。


        4楼2018-01-11 15:34
        收起回复
          From High Level to Machine Level Languages
          The interpreteris a machine level program, which interprets and executes the high level program, line by line.
          While the compilertranslates the completehigh level program to a machine level program.
          Python is an interpreted programming language.
          从高级到机器级语言
          解释器是一个机器级的程序,它逐行解释和执行高级程序。
          而编译器将完整的高级程序转换为机器级程序。
          Python是一种解释性编程语言。


          5楼2018-01-11 15:36
          收起回复
            My First Python Program: Hello World!
            The first line of code taught in all programming languages is a print command of a greeting.
            >>>print(“Hello World!”)
            Hello World!
            The text to the right of the prompt, >>>, is the “command” to the Python interpreter.
            The text in the next line is the value returned by the interpreter.
            我的第一个Python程序:Hello World!
            在所有编程语言中教授的第一行代码是打印命令的问候语。
            >>> print(“Hello World!”)
            你好,世界!
            提示右边的文本>>>是Python解释器的“命令”。
            下一行中的文本是解释器返回的值。


            7楼2018-01-11 15:41
            回复
              Python Programming Basics: Strings and Type ‘str’
              We now ask for the type of “Hello World!”
              >>>type(“Hello World!”)
              <class ‘str’>
              It is of type str, indicating this is a string.
              In python, a sequence of characters, enclosed by ‘single quotes’ or “double quotes”, is a string.
              Python编程基础:字符串和类型'str'
              我们现在要求“Hello World!”的类型
              >>> type(“Hello World!”)
              <class'str'>
              它是str类型,表示这是一个字符串。
              在Python中,由“单引号”或“双引号”包围的字符序列是一个字符串。


              8楼2018-01-11 15:42
              回复
                Concatenation and repetition
                Strings can be concatenated(glued together) with the + operator.
                For example:
                >>>“Hello ” +“World!” #concatenation
                ‘Hello World!’
                The text that start with the hash character, #, and extend to the end of the physical line is a comment.
                连接和重复
                字符串可以与+运算符串接(粘合在一起)。
                例如:
                >>>“Hello”+“World!”#concatenation
                '你好,世界!'
                以散列字符#开始并延伸到物理行末尾的文本是注释。


                9楼2018-01-11 15:43
                收起回复
                  2025-06-28 02:54:22
                  广告
                  Concatenation and repetition
                  Strings can be repeatedwith the * operator.
                  For example:
                  >>>“Hello” * 3
                  ‘HelloHelloHello’
                  连接和重复
                  字符串可以用*运算符重复。
                  例如:
                  >>>“你好”* 3
                  '你好你好你好'


                  10楼2018-01-12 00:07
                  回复
                    Concatenation and repetition
                    Strings can be repeatedwith the * operator.
                    For example:
                    >>>“Hello” * 3
                    ‘HelloHelloHello’
                    >>>“Hello” * 0
                    连接和重复
                    字符串可以用*运算符重复。
                    例如:
                    >>>“你好”* 3
                    '你好你好你好'
                    >>>“你好”* 0


                    11楼2018-01-12 00:08
                    回复
                      Concatenation and repetition
                      Strings can be repeatedwith the * operator.
                      For example:
                      >>>“Hello” * 3
                      ‘HelloHelloHello’
                      >>>“Hello” * 0
                      ‘’ # the empty string
                      >>> “
                      连接和重复
                      字符串可以用*运算符重复。
                      例如:
                      >>>“你好”* 3
                      '你好你好你好'
                      >>>“你好”* 0
                      '#空串
                      >>>“


                      12楼2018-01-12 00:08
                      回复
                        Indexing
                        We can also access the individual characters that make up the string.
                        We can think of the positionsin the string as being numbered, startingfrom the left with 0.
                        Indexing returns the item at specific position.

                        Syntax:<string>[<index>].
                        索引
                        我们也可以访问组成字符串的单个字符。
                        我们可以将字符串中的位置想象为从0开始的左边的数字。
                        索引将返回特定位置的项目。
                        语法:<字符串> [<指数>]。


                        13楼2018-01-12 00:12
                        回复
                          Indexing
                          Here are some examples:
                          >>>“Hello”[0]
                          ‘H’


                          14楼2018-01-12 00:12
                          收起回复
                            Indexing
                            Here are some examples:
                            >>>“Hello”[0]
                            ‘H’
                            >>>“Hello”[4]
                            ‘o’
                            索引
                            这里有些例子:
                            >>>“Hello”[0]
                            'H'
                            >>>“你好”。[4]
                            “O”


                            15楼2018-01-12 00:15
                            回复
                              2025-06-28 02:48:22
                              广告
                              Indexing
                              Here are some examples:
                              >>>“Hello”[0]
                              ‘H’
                              >>>“Hello”[4]
                              ‘o’
                              >>> “Hello”[5]
                              索引
                              这里有些例子:
                              >>>“Hello”[0]
                              'H'
                              >>>“Hello”。[4]
                              “O”
                              >>>“Hello”[5]


                              16楼2018-01-12 00:17
                              回复