Python notes 0001:Computer

1 Basic computer knowledge

1.1 Definition

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically.

Functions that can be achieved:

  • Numerical calculation.
  • Logical calculation.
  • Storage and memory function

It is a modern intelligent electronic device that can run according to the program and process data automatically and at a high speed.

1.2 Composition

A computer includes:

  • Hardware
  • Operating System (main software)
  • Peripheral equipment used for operation

Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard.
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Software is a collection of instructions and data that tell a computer how to work.

1.3 Interactive logic

Hardware
Operating system
Application software
User

2 Command

2.1 Dos command

Complete List of MS-DOS Commands

DOS commands are the commands available in MS-DOS that are used to interact with the operating system and other command line based software.
Unlike in Windows, DOS commands are the primary way in which you use the operating system. Windows and other modern OSs use a graphics-based system designed for touch or a mouse.This means that users can operate according to the image without having to face a monotonous and threshold command window.
Note: If you use Windows (like Windows 10, 8, 7, etc.), then you have no need for DOS commands because you don’t have MS-DOS.

2.2 Windows commands

2.2.1 What is Windows?

Microsoft Windows, commonly referred to as Windows, is a group of several proprietary graphical operating system families, all of which are developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. Active Microsoft Windows families include Windows NT and Windows IoT; these may encompass subfamilies, (e.g. Windows Server or Windows Embedded Compact) (Windows CE). Defunct Microsoft Windows families include Windows 9x, Windows Mobile, and Windows Phone.
Windows Logo

2.2.2 Interactive mode

Types of interaction

  • TUI: Text-based User Interface
  • GUI: Graphical User Interface

2.2.3 How to open the text interaction mode

Win + r
②Enter “cmd” in the input box.
③Click “OK”.
Run-window

2.2.3 Command line structure

  • Microsoft Windows [Version 10.0.19041.868] →Version
  • © 2020 Microsoft Corporation. All rights reserved. →Copyright notice
  • C:\Users\WDAGUtilityAccount →Disk path, current folder path
  • > > > →Command prompt, you can enter commands directly later.

2.2.4 Windows commands

Common Windows commands(The more important commands have been bold in the table. Each keyword has been linked to the corresponding page of the official website document.)

CommandAnnotation
cdDisplays the name of the current directory or changes the current directory. If used with only a drive letter (for example, cd C:), cd displays the names of the current directory in the specified drive. If used without parameters, cd displays the current drive and directory.
clsClears the Command Prompt window.
colorChanges the foreground and background colors in the Command Prompt window for the current session. If used without parameters, color restores the default Command Prompt window foreground and background colors.It’s not very useful, but sometimes you can change the color you like when you get tired of the monotonous command window with white words on a black background.
delDeletes one or more files. This command performs the same actions as the erase command.The del command can also run from the Windows Recovery Console, using different parameters.
deleteDeletes a partition or a volume. It also deletes a dynamic disk from the list of disks.Please use it carefully
dirDisplays a list of a directory’s files and subdirectories. If used without parameters, this command displays the disk’s volume label and serial number, followed by a list of directories and files on the disk (including their names and the date and time each was last modified). For files, this command displays the name extension and the size in bytes. This command also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.The dir command can also run from the Windows Recovery Console, using different parameters.You can use it when viewing the contents of a folder .
exitExits the command interpreter or the current batch script.
ftpTransfers files to and from a computer running a File Transfer Protocol (ftp) server service. This command can be used interactively or in batch mode by processing ASCII text files.
helpDisplays a list of the available commands or detailed help information on a specified command. If used without parameters, help lists and briefly describes every system command.It is a powerful tool when you are not familiar with Windows commands.
mkdirCreates a directory or subdirectory. Command extensions, which are enabled by default, allow you to use a single mkdir command to create intermediate directories in a specified path.
moveMoves one or more files from one directory to another directory.
openfilesEnables an administrator to query, display, or disconnect files and directories that have been opened on a system. This command also enables or disables the system Maintain Objects List global flag.
pathSets the command path in the PATH environment variable, specifying the set of directories used to search for executable (.exe) files. If used without parameters, this command displays the current command path.
ping①Verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) echo Request messages. The receipt of corresponding echo Reply messages are displayed, along with round-trip times. ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution. Used without parameters, this command displays Help content.②You can also use this command to test both the computer name and the IP address of the computer. If pinging the IP address is successful, but pinging the computer name isn’t, you might have a name resolution problem. In this case, make sure the computer name you are specifying can be resolved through the local Hosts file, by using Domain Name System (DNS) queries, or through NetBIOS name resolution techniques.
PowerShellWindows PowerShell is a task-based command-line shell and scripting language designed especially for system administration. Built on the .NET Framework, Windows PowerShell helps IT professionals and power users control and automate the administration of the Windows operating system and applications that run on Windows.
rmdirDeletes a directory.The rmdir command can also run from the Windows Recovery Console, using different parameters.
shutdownEnables you to shut down or restart local or remote computers, one at a time.It is recommended that you test this command after you have saved the file and there is no need to use the computer immediately.
startStarts a separate Command Prompt window to run a specified program or command.
whereDisplays the location of files that match the given search pattern.

2.3 Linux commands

2.3.1 What is Linux?

Linux (/ˈlinʊks/ (About this soundlisten) LEEN-uuks or /ˈlɪnʊks/ LIN-uuks) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution.
Tux the penguin, mascot of Linux

2.3.2 Linux command

Linux Command Guide(Click here to jump.)

3 Programming languages

3.1 Classification

There are thousands of different programming languages—some intended for general purpose, others useful only for highly specialized applications.

Lists of programming languagesExamples
Assembly languagesARM, MIPS, x86
High-level programming languagesAda, BASIC, C, C++, C#, COBOL, Fortran, PL/I, REXX, Java, Lisp, Pascal, Object Pascal
Scripting languagesBourne script, JavaScript, Python, Ruby, PHP, Perl

There are two more important concepts:
Compiled language: is a programming language whose implementations are typically compilers (translators that generate machine code from source code), and not interpreters (step-by-step executors of source code, where no pre-runtime translation takes place).

  • For low-level programming languages, there are more one-to-one correspondences between the programmed code and the hardware operations performed by machine code, making it easier for programmers to control the use of central processing unit (CPU) and memory in fine detail.

Scripting language(or script language): is a programming language for a runtime system that automates the execution of tasks that would otherwise be performed individually by a human operator. Scripting languages are usually interpreted at runtime rather than compiled.

  • A scripting language is usually interpreted from source code or bytecode. By contrast, the software environment (interpreter) the scripts are written for is typically written in a compiled language and distributed in machine code form.
  • Typical scripting languages are intended to be very fast to learn and write in, either as short source code files or interactively in a read–eval–print loop (REPL, language shell).

3.2 Running speed

Why is Python slower than other languages?.

Python is a scripting language while C is a compiled language. C/C++ is relatively fast as compared to Python because when you run the Python script, its interpreter will interpret the script line by line and generate output but in C, the compiler will first compile it and generate an output which is optimized with respect to the hardware. In case of other languages such as Java and.NET, Java bytecode, and .NET bytecode respectively run faster than Python because a JIT compiler compiles bytecode to native code at runtime. CPython cannot have a JIT compiler because the dynamic nature of Python makes it difficult to write one.

If I want to recommend Python

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值