Practice10 - Operasi String With Python

Overview

Operasi String

instagram instagram instagram

MY SOSIAL MEDIA :

instagram
facebook
twiter
whatapp

Apa itu Python String ?

String adalah urutan simbol yang terbatas yang dipilih dari himpunan yang disebut alfabet.

  • String adalah jenis yang paling populer di Python.
  • Untuk membuatnya hanya dengan melampirkan karakter dalam tanda kutip.
  • Python memperlakukan tanda kutip tunggal sama dengan tanda kutip ganda.
  • Membuat string semudah memberi nilai pada sebuah variabel.

main.py

OUTPUT PROGRAM eza

Deskripsi

1. Bagaimana menghitung jumlah karakter pada string ?
cara menghitung karakter pada string yaitu menggunakan method len( )
Contoh:

print(len('Hello World'))

methode len() pada python di gunakan untuk menghitung karakter pada string.

2. Bagaimana cara mengambil satu karakter pada string ?
cara mengambil satu karakter pada string yaitu dengan menggunakan kurung siku [ ] dan deklarasi nomor di dalam kurung siku dengan urutan ARRAY dan menggunakan titik dua lalu masukan nomor ARRAY selanjutnya.
Contoh:

print(txt[10])

3. Bagaimana Cara Mengambil Karakter ke 2 s/d 4 ?
cara menggambil karakter 2 s/d 3 menggunakan kurung siku yang di deklarasi nomor ARRAY
Contoh:

print(txt[2:5])

4. Bagaimana cara menghilangkan spasi pada string ?
cara menghilangkan spasi pada string yaitu menggunakan method replace()
contoh:

txt = "Hello World"
print(replace(txt[5]))

methode replace() mengganti semua kemunculan string lama dengan yang baru atau paling banyak kemunculan.

5.Bagaimana cara menguah string menjadi huruf besar atau hurup kecil ?
cara merubah hurup besar/kecil pada string yaitu menggunakan methode:

  • upper() untuk memperbesar
  • lower() untuk memperkecil
    contoh:
txt = "Hello world"
print(txt.upper()) #memperbesar
print(txt.lower()) #memperkecil

6.Bagaimana cara mengganti karakter pada string ?
Contoh mengganti karaket H menjadi J pada karakter "Hello World" :

txt = "Hello World"
print(replace(txt[:1]))

di sini cara mengganti karakter masih menggunakan method replace( ) dan di deklarasi nomor ARRAY pada kurung siku.

Owner
Maulana Reza Badrudin
instagram : @rezastein_ 🦏🦏🦏🦏🦏🦁🦗🦎🐊🐀🐒🦧🐣🐖🦐🦟🐌🦋🍼🍦🥜🍺🧊🥒🌶️🍌🍥🥠🍡☕🍩🥚🥥
Maulana Reza Badrudin
A general illumination correction method for optical microscopy.

CIDRE About CIDRE is a retrospective illumination correction method for optical microscopy. It is designed to correct collections of images by buildin

Kevin Smith 31 Sep 07, 2022
Pymon is like nodemon but it is for python,

Pymon is like nodemon but it is for python,

Swaraj Puppalwar 2 Jun 11, 2022
A bunch of codes for procedurally modeling and texturing futuristic cities.

Procedural Futuristic City This is our final project for CPSC 479. We created a procedural futuristic city complete with Worley noise procedural textu

1 Dec 22, 2021
A python script for compiling and executing .cc files

Debug And Run A python script for compiling and executing .cc files Example dbrun fname.cc [DEBUG MODE] Compiling fname.cc with C++17 ------------

1 May 28, 2022
My Analysis of the VC4 Assembly Code from the RPI4

My Analysis of the VC4 Assembly Code from the RPI4

Nicholas Starke 31 Jul 13, 2022
FantasyBballHelper - Espn Fantasy Basketball Helper

ESPN FANTASY BASKETBALL HELPER The simple goal of this project is to allow fanta

1 Jan 18, 2022
PyMedPhys is an open-source Medical Physics python library

PyMedPhys is an open-source Medical Physics python library built by an open community that values and prioritises code sharing, review, improvement, and learning from each other. I

PyMedPhys 238 Dec 27, 2022
TinyBar - Tiny MacOS menu bar utility to track price dynamics for assets on TinyMan.org

📃 About A simple MacOS menu bar app to display current coins from most popular Liquidity Pools on TinyMan.org

Al 8 Dec 23, 2022
A collection of UIKit components that can be used as a Wagtail StreamField block.

Wagtail UIKit Blocks A collection of UIKit components that can be used as a Wagtail StreamField block. Available UIKit components Container Grid Headi

Krishna Prasad K 13 Dec 15, 2022
Percolation simulation using python

PythonPercolation Percolation simulation using python Exemple de percolation : Etude statistique sur le pourcentage de remplissage jusqu'à percolation

Tony Chouteau 1 Sep 08, 2022
Simple python bot, that notifies about new manga chapters through Telegram.

Simple python bot, that notifies about new manga chapters through Telegram.

Dmitry Kopturov 1 Dec 05, 2021
万能通用对象池,可以池化任意自定义类型的对象。

pip install universal_object_pool 此包能够将一切任意类型的python对象池化,是万能池,适用范围远大于单一用途的mysql连接池 http连接池等。 框架使用对象池包,自带实现了4个对象池。可以直接开箱用这四个对象池,也可以作为例子学习对象池用法。

12 Dec 15, 2022
A python script for practicing Toki Pona.

toki.py A python script for practicing Toki Pona. Modified from a hirigana script by ~vilmibm. Example of the script running: $ ./toki.py This script

Dustin 2 Dec 09, 2021
🔤 Measure edit distance based on keyboard layout

clavier Measure edit distance based on keyboard layout. Table of contents Table of contents Introduction Installation User guide Keyboard layouts Dist

Max Halford 42 Dec 18, 2022
Um Script De Mensagem anonimas Para linux e Termux Feito em python

Um Script De Mensagem anonimas Para linux e Termux Feito em python feito em um celular

6 Sep 09, 2021
디텍션 유틸 모음

Object detection utils 유틸모음 설명 링크 convert convert 관련코드 https://github.com/AI-infinyx/ob_utils/tree/main/convert crawl 구글, 네이버, 빙 등 크롤링 관련 https://gith

codetest 41 Jan 22, 2021
JSEngine is a simple wrapper of Javascript engines.

JSEngine This is a simple wrapper of Javascript engines, it wraps the Javascript interpreter for Python use. There are two ways to call interpreters,

11 Dec 18, 2022
FBChecker Account using python , package requests and web old facebook

fbcek FBChecker Account using python , package requests and web old facebook using python 3.x apt upgrade -y apt update -y pkg install bash -y pkg ins

XnuxersXploitXen 5 Dec 24, 2022
switching computer? changing your setup? You need to automate the download of your current setup? This is the right tool for you :incoming_envelope:

🔮 setup_shift(SS.py) switching computer? changing your setup? You need to automate the download of your current setup? This is the right tool for you

Mohamed Elfaleh 15 Aug 26, 2022
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022