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
Subscribe, listen and (in the future) download your favorite podcasts, quickly and easily.

Minimal Podcasts Player https://github.com/son-link/minimal-podcasts-player Subscribe, listen and (in the future) download your favorite podcasts, qui

Alfonso Saavedra 14 Nov 11, 2022
Cobalt Strike Sleep Python Bridge

This project is 'bridge' between the sleep and python language. It allows the control of a Cobalt Strike teamserver through python without the need for for the standard GUI client. NOTE: This project

Cobalt Strike 140 Jan 04, 2023
Estimating the potential photovoltaic production of buildings (in Berlin)

The following people contributed equally to this repository (in alphabetical order): Daniel Bumke JJX Corstiaen Versteegh This repository is forked on

Daniel Bumke 6 Feb 18, 2022
๐Ÿค–๐Ÿค– Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... ๐Ÿค–๐Ÿค–

Jarvis ๐Ÿค– ๐Ÿค– Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... ๐Ÿค– ๐Ÿค– Developer : su

1 Nov 08, 2021
Automate the boilerplate while initializing your Python project

Rubric Automate the boilerplate while initializing your Python project Preface Rubric is an opinionated project initializer for Python. It assum

Redowan Delowar 23 Dec 16, 2022
This script is written with Python for selling steam community items automatically.

SteamCommunityItemAutoSell Description This script is written with Python for selling steam community items automatically. Install git clone https://g

14 Oct 26, 2022
x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

5 Jan 24, 2022
Nfog - Scriptable Database-Driven NFO Generator for Movies and TV

nfog Scriptable Database-Driven NFO Generator for Movies and TV. Installation pi

6 Oct 08, 2022
A module comment generator for python

Module Comment Generator The comment style is as a tribute to the comment from the RA . The comment generator can parse the ast tree from the python s

้ฃ˜ๅฐ˜ 1 Oct 21, 2021
Dotfiles for my configurations!

Dotfiles Repo Welcome! Over here, you can find my dotfiles for various applications, including QTile, Alacritty, Kitty, LunarVim, and more! Make sure

class PythonAddict 3 Jan 10, 2022
A fishing bot script written in Python!

A fishing bot script written in Python!

Anel Drocic 3 Nov 03, 2021
Draw random mazes in python

a-maze Draw random mazes in python This program generates and draws a rectangular maze, with an entrance on one side and one on the opposite side. The

Andrea Pasquali 1 Nov 21, 2021
๐Ÿ‡ฎ๐Ÿ‡ณ A Indian Flag Animation Project Made With Python

๐Ÿ‡ฎ๐Ÿ‡ณ A Indian Flag Animation Project Made With Python

MuFaz-TG 2 Oct 21, 2022
Headless - Wrapper around Ghidra's analyzeHeadless script

Wrapper around Ghidra's analyzeHeadless script, could be helpful to some? Don't tell me anything is wrong with it, it works on my machine.

8 Oct 29, 2022
Simple AoC helper program you can use to develop your own solutions in python.

AoC-Compabion Simple AoC helper program you can use to develop your own solutions in python. Simply install it in your python environment using pip fr

Alexander Vollmer 1 Dec 20, 2021
LanguageCreator - Simple library for easy creation transpilator.

LanguageCreator - Simple library for easy creation transpilator. Create transpilators in one hour! Install. Download code, rename folder to "LanguageC

Ivan Perzhinsky. 2 Dec 31, 2021
Our product DrLeaf which not only makes the work easier but also reduces the effort and expenditure of the farmer to identify the disease and its treatment methods.

Our product DrLeaf which not only makes the work easier but also reduces the effort and expenditure of the farmer to identify the disease and its treatment methods. We have to upload the image of an

Aniruddha Jana 2 Feb 02, 2022
Your E-Canteen that is convenient and accessible wherever you are in the campus

Food Web E-Canteen System Your E-Canteen that is convenient and accessible wherever you are in the campus. Table of Contents About The Project Contrib

Pudding 5 Jan 07, 2023
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

Atharva Parkhe 1 Feb 23, 2022
Simple python script for AD enumeration

AutoAD - Simple python script for AD enumeration This tool was created on my spare time to help fellow penetration testers in automating the basic enu

Mohammad Arman 28 Jun 21, 2022