0

Please help mešŸ™šŸ™

I wanna to print a word or a number but not all the letters or digits for example i wanna print "0921677821" but without "0" Or print "abcdefgh" but from "b" to "f" What should i do?

24th May 2020, 12:14 PM
Behrad Bahrami
8 Answers
+ 9
You should familiarize yourself with slicing: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453 (works similar for strings)
24th May 2020, 12:17 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Thank you for your helpšŸ˜šŸŒ¹
24th May 2020, 12:21 PM
Behrad Bahrami
+ 3
You can do it by slicing
25th May 2020, 8:53 PM
Mehnaz ✨
Mehnaz ✨ - avatar
+ 1
Thank you allšŸ¤©šŸ™
24th May 2020, 12:19 PM
Behrad Bahrami
+ 1
for i in "0921677821": if int(i)!=0: print(i) for i in "abcdefgh": if i>="b" and i<="f": print(i)
24th May 2020, 12:20 PM
Abhay
Abhay - avatar
+ 1
Use slicing of strings. It goes like this...str[a:b] This string will start from a and go till (b-1). Note that b isn't included in the string
25th May 2020, 9:54 PM
Shivangi Agarwal
0
Can you explain it?
25th May 2020, 9:33 PM
Behrad Bahrami