best way to learn python for non programmer

Want to know best way to learn python for non programmer? we have a huge selection of best way to learn python for non programmer information on alibabacloud.com

Stupid way to learn Python (15)

this script with Raw_input, think of the way to get the file name better, and why.6. Run Pydoc file to scroll down until you see the read () command (function/method). See a lot of other orders, you can find a few to try. No need to look at the commands that contain __ (two underscores), these are just rubbish.7. Run Python again at the command line to open a file, this open and read method is also worth l

Stupid way to learn Python (32)

list6 forNumberinchThe_count:7 Print "This is count%d"% Number8 9 #Same as aboveTen forFruitinchFruits: One Print "A Fruit of type:%s"%Fruit A - #also we can go through mixed lists too - #Notice we have the use of %r since we don ' t know what's in it the forIinchChange : - Print "I got%r"%I - - #We can also build lists, first start with an empty one +elements = [] - + #Then use the range function to does 0 to 5 counts A forIinchRange (0, 6): at Print "Adding%d to the lis

Stupid way to learn Python (vi)

commas (comma). Just like you go to the store and say, "I want to buy milk, bread, eggs, eight treasures porridge," just as programmers say "(milk, eggs, bread, soup)."We will type a large number of strings, variables, and formatting characters, and print them out. We'll also practice using the shorthand variable name. Programmers like to use shorthand for annoying difficulty to save typing time, so let's learn this early so that you can read and wri

Learn Python The Hard Way learning (29)-What is If

Next, we will learn the if statement and enter the following code to ensure proper running.[Python]People = 20Cats = 30Dogs = 15If people Print "Too success cats! The world is doomed! "If people> cats:Print "Not found cats! The world is saved! "If people Print "The world is drooled on! "If people> dogs:Print "The world is dry! "Dogs + = 5If people> = dogs:Print "People are greater than or equal to dogs ."If

Learn Python The Hard Way learning (32)-loop and list

Next we will do some interesting things. if you follow the progress, you will find that you can use the if statement and Boolean expression to do a lot of things. In any case, the program will do some repetitive tasks. Next we will print a list variable with a for loop. During this exercise, you must understand their meanings and functions. Before using the for loop, we need to save the value of the loop. The best way is to use a list. The list is the

How can C and python learn in a balanced way?

The school teaches the C language, and wants to learn how Python weighs two languages, without the confusion of language learning. There are advantages and disadvantages to this study. Reply content:Both C and Python are ideal languages for 0 basic introductory learning programming. Different people have different personalities, different ways of thinking about p

Lpthw stupid way to learn Python Chapter 16

Some extensions are made according to the content of chapter 16.For example, if a file exists, it is appended to the file and created if it does not exist.It also draws on a method similar to the cat Now there is a small pit, how to use Python to read a file of the number of rows, the original Os.system ("Wc-l filename") is OK, but how to operate under Windows? Fill it back.#!/usr/bin/env python#-*-coding:u

Stupid way to learn Python (exercise 0)

First, learn to use terminal to create a directoryMkdir--make Directory CreationUsage: $ mkdir Example:1, $ mkdir Test001Create a "Test001" directory under the current directory2, $mkdir test001/test002Create the directory "test001/test002" under the current directory, and generate the appropriate directory if the directory "test001/test002" does not exist.3. If a file (or folder) named Test001 is present in the current directory, the $ mkdir Test001

Stupid way to learn python (11)

) behind each line of print, right? In this case, print will not output new line breaks and end this line to the next line.You should see the result:Bonus points Exercise1. Surf the web to find out what features Python Raw_input implements.2. Can you find any other usage of it? Test the example you searched for online.3. Write a paragraph in a similar format and change the question to your own.4. In relation to escape sequences, think about why the la

A simple way to learn Python 1

How to open a file in cmd : First open the cmd interface with Win+r , after the address known to you to open the file, such as (f:\ Workspace), you press F:and then you enter workspace with the CD workspace File , and then put in the file you want to open (the name + file type), and then you can open the file. in the in Python, the function of entering characters is:input(which can be any character), and the characters in parentheses are printed .The

Stupid way to learn Python (20)

Print_a_line runs, you pass a variable called current_line . Each time the function is called, the current_line is printed out to track how it becomes line_count in the print_a_line . Find out where each function is used in the script. Check the def line to verify that the parameter is not used correctly. Go online and study what the seek function in file does. Try running pydoc file to see if you can learn more. Consider the function of the s

Learn Python The Hard Way learning (38)-list operations

: append (mystuff, 'Hello ').In most cases, you don't have to know what is going on, but it helps when you encounter the following error:Www.2cto.com :~ # PythonPython 2.6.5 (r265: 79063, Apr 16 2010, 13:09:56)[GCC 4.4.3] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> Class Thing (object ):... Def test (hi ):... Print "hi"...>>> A = Thing ()>>> A. test ("hello ")Traceback (most recent call last ):File "TypeError: test () takes exactly 1 argument (2 given)>>> W

Stupid way to learn Python learning notes

Created on: 2016-02-29Update: 02-29Python version: 2.7 %r is good for debugging because it shows the raw data of the variable, while the other symbols are used to show the output to the user; Print will not output line breaks If you add one after each line of print (comma). argv command-line arguments are strings, so it is necessary to convert int () to a number when the number is involved, raw_input () is also a string. Common ways to read and write files: close,read,readline,tru

Stupid way to learn Python: functions and files

fromSysImportArgvscript,input_file=argvdefPrint_all (f):PrintF.read ()defRewind (f): F.seek (0)defPrint_a_line (line_count,f):Printline_count,f.readline () current_file=Open (input_file)Print"First let ' s print the whole file:\n"Print_all (current_file)Print"Now let's rewind, kind of like a tape."Rewind (Current_file)Print"Let ' s print three lines:"Current_line=1print_a_line (current_line,current_file) current_line=current_line+1print_a_line (current_line,current_file) current_line=current_lin

"Stupid way to learn Python" 18th Lesson notes __python

the 18th lesson of the stupid way to learn Python This class will create a function that is similar to the definition function in the C language. The author adds an English comment that explains the function at the beginning of each function. For ease of understanding, I will directly explain some of the code involved in the knowledge point after the original co

Learn Python The Hard Way learning (4)-variables and names

We have learned printing and mathematical computation. Next we will learn variables. in the program, variables are a name, which makes it easier for us to remember. If you are overwhelmed by the following exercises, remember the methods we taught before and find different points. Pay attention to the details:1. Write comments for each line of code.2. Read the code in turn.3. Read your code. [Python]1. cars

Stupid way to learn python exercise 18 naming, variables, code, and functions

Next we start to learn about "functions." The function can do the following 3 things. 1, they name the code snippet, just like "variable" to string and to name 2, they can accept the parameters, just like your script accepts argv. 3, using # and #, they let you create "mini script" or "small command" First, put the code: (slightly modified with the code in the textbook) #-*-coding:utf-8-*- #this One is like your script with argv def print_two (*args)

Learn Python The Hard Way learning (10)-What is that?

In the 9th exercises, we use two methods to wrap the line. The first method is to add \ n. Adding different characters After \ can indicate different meanings. If it is "\", it indicates printing \. The other two important escape sequences are 'and ". If the string you want to print is enclosed by" and contains ", for example," I "understand" joe. ", python will think that" after I "is the end of the string. To solve this problem, you can do the follo

The way to learn Python

to query (enter Q exit):" ") Company="'#pre-defined units whileCompany! ='Q': Department=input ()ifDepartment = ='Q': Break elif notDepartmentinchDic_of_ncepu:Print('The system is not queried, please re-enter') Continue Else: ifLen (dic_of_ncepu[department]) = = 1: Print(Dic_of_ncepu[department])Else: Print('Please enter the subordinate units of the department you are inquiring about: (press B to return, press Q to exit)') whileTrue

Stupid way to learn Python's modules, classes, objects

are like importedIf the class is like a module, then there should also be an import-like concept. In a class, this concept is called instantiation, and when a class is instantiated, it gets the object of a class.Create a class;Class MyStuff (object):def __init__ (self):SELF.A = ' How is it? 'def apple (self):Print ("I am classy apple")b = MyStuff () #类的实例化B.apple () #调用类的方法Print b.a# properties of the printing classAnalyzing the instantiation of a class this sentence actually

Total Pages: 5 1 2 3 4 5 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.