Friday, May 24, 2024

Diploma Python Programming - Module 02 - Alison 03

KIta sekarang masuk ke Python programing untuk Module 2. Dimana di Module ini kita akan bicara tentang "Displaying Text)"


Image - Python programming.

Diploma Python programming, module 02: Displaying Text - Online Course | Alison

Di sini, kita akan melihat tampilan text.

' ' ...> single quote
"  " ...> double quote

print('apa kabar')
print("apa kabar")
output: apa kabar ...> hasilnya sama saja.

pemakaian \n ...> to force new line.
print("Hickory Dock\nThe mouse run up")
Run Python file:
Hickory Dock
The mouse run up


The key points from this module are:
Your text inside prints brackets must be enclosed with quotes, Python accepts both single ‘ and double “ quotes.

For printing on multiple lines you could use multiple print statements or you can use \n which declares a new line for the text that follows it.

You can you triple quotes for the text to display, as you have typed it into the editor this is not a recommended method as most other programming languages don’t support it.

You will make mistakes when programming all programmers make mistakes from typing mistakes to logic mistakes, it is not something to stress over.

Recommend solutions to fixing mistakes you can’t find or having trouble with:- Walk away and come back to it,- Have another coder look at it;- Step though your code with your debugger.

Next Lesson: Module 3

===============================
===============================

Dave Gray (10/24)


Kita mulai dengan recursion

angka 1 sampai 9
def add_one(num):

    if (num >= 9):
        return num + 1
   
    total = num + 1
    print(total)

    return add_one(total)

add_one(0)
Run Python File:
1
2
3
4
5
6
7
8
9

sekarang, dari angka 1 sampai 10
def add_one(num):

    if (num >= 9):
        return num + 1
   
    total = num + 1
    print(total)

    return add_one(total)

mynewtotal = add_one(0)
print(mynewtotal)
Run Python File:
1
2
3
4
5
6
7
8
9
10

Coding sederhana dan sedikit enhance untuk Scissor games bisa di lihat Module 10 

Pelajaran lanjutan (11/24) : Python Scope tutorial for Beginners - YouTube

JJJJJJJJJJJJJJJJJJJJ


JJJJJJJJJJJJJJJJJJJJ

No comments:

Post a Comment