Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.23 KB | None | 0 0
  1.     https://learnxinyminutes.com/docs/python3/
  2.     https://www.youtube.com/watch?v=xfBWk4nw440
  3.    
  4.     Python is a programming language, difference between programming.
  5.     Good points of python (not a lot of line, open-source, big community, multi-platform)
  6.    
  7.     1. Variables (name should be meaningful, more maintainable - should be consistent)
  8.         a. Number, string, bolean (True or False), array
  9.             Temperature = [40,20,-10,25]
  10.         b. Format properly
  11.         c. Built-in function
  12.             i. len() - certain are needed argument(s)
  13.             ii. Print(f"({x})")
  14.         d. [] are index [-1] [0:3] [0:] [:3]
  15.         e. Specific function for number, string, bolean = NameVariable.upper() (not see in class :p)
  16.        
  17.     2. Comment to explain your code to you but other ones
  18.    
  19.     3. Basic math
  20.         a. + - * / // % ** +=
  21.         b. round, abs
  22.         c. Import math (object)
  23.             i. math.log() (google example)
  24.         d. Operators > < == !=
  25.        
  26.     4. If
  27.         a. Every program you have to make a decision, that's why we have
  28.         If temperature[1] > 35:
  29.             Print('Evie will not be cold')
  30.         Elif temperature[1] < 30:
  31.             Print('Evie will be cold')
  32.         b. Operators and or
  33.        
  34.     5. For loop (we don't want to repeat a task for a number of time)
  35.         for number in range(1,5):
  36.             Print("Student", number)
  37.         a. Step (1,2,10)
  38.        
  39.     6. Combine for and if
  40.         for i in range(1,5):
  41.             If temperature[i] > 0:
  42.                 Print(f'At {temperature(i)}, it's not frozen')
  43.                
  44.     7. Exercise 1: An artist want to make some ice statues of Trump in front of series of meteorological stations. He gives you a database with 10 stations (imagine there are thousands) and ask you a program that can deliver which station is below 0C but not below -10C. He also want the number of stations to know which quantity of materials he should bring.
  45.         Count = 0
  46.         For i in range (1,10):
  47.             If -10<temperature(i)<0
  48.                 Count += 1
  49.                 Print(f"Station {i} is good")
  50.         Print(f"we have {count) stations possible")
  51.        
  52.     8. nested loop
  53.         For x in range(1,5):
  54.             For y in range(1,3):
  55.                 Print(f"({x},{y})")
  56.                
  57.     9. Libraries (resources that you can use by using help on google)
  58.         a. Example: plot with matplotlib
  59.                
  60.     10. Function (make smaller code)
  61.         Def frozen(database):
  62.             …
  63.            
  64.         Frozen(temperature)
  65.        
  66. Exercise 2: Find the prime numbers from 2 to 1000.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement