Practice – before make project – level 1

huyhuy17

How to make a simple program on IDLE of Python – Hotline :01889940451

# App structure 
# App structure 
1. Start - introduce
2. Start app -loop 
Loop:
    1. Show guide for user
    2. User input
    3. Process input
    while condition : 
        1. if correct command pass to calculate process
        2. if not correct command , ask user to input again            
    4. Calculate, process the order from user 
    5. Show user result
break: 
3. Exit loop
4. Goodbye 

# Required knowledge
0. How to use input, print and other operators (+, -,* ,/ ,// ,% ,and, or, <=, >=, !=, ==, ... )
1. format string
```python
print ("Hello {myname}".format(myname = "Huy"))
```
2. data type convert:
```python
int( "10") == 10
str(123456)  == "12346"
float (1) == 1.0
```
3. Process wrong input 
```python
age = int(input('How old are you?'))
while age < 0 or age > 150:
    print ("Your age cant smaller than 0 or 150. Don\'t cheat me!")
    age = input('How old are you? again')
```
4. Use if elif else
```python
age = 10 
if age > 25 :
    print("In your age, you should have a job")
elif 18 < age <=25: print("In your age, you should study in a university") else: print("In your age, you should study in a school") ``` 5. Use for in range| list ```python # cal sum from 1 to 10: sum = 0 for i in range(11): sum +=i print ("Sum from 1 to 10 is {sum}".format(sum = sum)) # print all student name in classroom students = ['Loic' ,'Hoang', 'Tung' , 'Kim', 'Mai'] for student in students: print(student) ``` 6. Use dictionary (should remember); ```python mystudents = [ {"name": "Tung", "score": 10} ,{"name": "Mai", "score": 7} ,{"name": "Hoang", "score": 6} ,{"name": "Peter", "score": 4} ] for student in mystudents: if student["score"] > 5:
        status = "pass"
    else: 
        status = "fail"
    print("Student {name} has score {score} for Pyton so she/he get {status} "
    .format(name = student['name'], score= student['score'], status= status))
```

# Brainstorming

## Shop app:
0. Rules: 
- has 6-10 products data
- has option to show all product data
- has option for user input name of product, quantity to buy
- has option to print data all user demand
- has option to end program
- has option to print show the revenue
...
1. Guide: 
- dictionary of products and price
```python
products  = {
    "orange" : {"price": 1000,"quantity":10}
    ,"apple" : {"price": 2000, "quantity": 12}
}
```
- show info of product: 
```python
products  = {
    "orange" : {"price": 1000,"quantity":10}
    ,"apple" : {"price": 2000, "quantity": 12}
}
for item in products : 
    print ("{name}: {price}vnd |remain {quantity} item(s)"
    .format(name = item , price = products[item]["price"], quantity = products[item]["quantity"]))

```
## Story tell app:
0. rules :
- has story 
- has option to choose: next storyline, do a action (which can lead to another end)
- has mini game: solve a math, answer the puzzle, guessing game,...
- has 3 end : true end, good end, bad end

## Turtle draw: 
0. rules:
- ask user option to draw
- process all data input to ensure it is true
- draw it by use input 
- has option to end

4 Replies to “Practice – before make project – level 1”

  1. not bad

  2. great site your thing is awesome for coding amateurs

  3. Ban Danny o cua hang “Noée’s overcooked food”.
    Ban co the mua:
    – Fried Potato Sticks
    – Orange vegetable soup
    – Saucy Bangers and mash
    – Barbecued muscles
    – Wholesome chop suey

  4. Thanh Tung
    dang o cua hang crack&negro
    duoc chon 10 san pham
    1.Bim Bim Nigger
    2. keo spermies
    3. mi tom KKK
    4. kem Ching chong Ling Long
    5. xux xich Suc Dik
    6.banh golden gay time
    7.thit bo anus
    8.my cock
    9.keo cao su Camel balls
    10.Pizza McPusssy
    moi thuc an thi nguoi choi phai tra loi mot cau hoi
    1. loic co ban khong ?
    2.69+69-69*69/69
    3.Nu hoang nuoc anh la ai
    4.ai da giet Abraham lincon (tong thong 13 Nuoc my)
    5. pokemon thu 151 la con nao
    6.ho co nguy hiem khong
    7. lam bai tap chua
    8.Ai da an pizza ma loic da an
    9. Ban thich pizza MCpussy
    10.666/1 =
    neu cau hoi dung thi hoi la nguoi choi muon mua moi cai
    neu cau hoi sai thi chon mot cai san pham khac

Trả lời