Thank you for your great sharing!! But I've a question about extracting the characters from a string. For example: x = "Hello" how can I specifically extract the 2nd and 5th character from this string to give an output: eo Thank you
@q807793 жыл бұрын
print(x[1]+x[4])
@cwpeng-course3 жыл бұрын
Thanks @Ricky Lin ~
@eader1008 ай бұрын
馬上想到的就是用來做16進為 10進位的轉換.... 之前為了在BAT裡面做這個轉換寫了好長一串...... set /a B=DEC setlocal enabledelayedexpansion set "hex_chars=0123456789ABCDEF" set "B_hex=" :loop_DEC set /a "remainder=B %% 16" set "B_hex=!hex_chars:~%remainder%,1!!B_hex!" set /a "B=B / 16" if %B% gtr 0 goto loop_DEC set DEC=%B_hex%
@cwpeng-course8 ай бұрын
感謝你的分享,很棒 :)
@eader1008 ай бұрын
@@cwpeng-course 笑死結果根本不用搞這麼複雜哈哈🤣🤣 n=int(input('type num1 ')) m=int(input('type num2 ')) print("num1 is %x num2 is %x" %(n,m))
老師, 請問假如我想定義兩個變數,內容有包含雙引號的對話內容 例如: greeting = " Good morning! How are you?" person = "Pongpong says." 然後 print (greeting + person) 讓結果呈現出來是 " Good morning! How are you?" Pongpong says.
請問老師 我打完後會出現這個 phython : The term 'phython' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a p ath was included, verify that the path is correct and try again. At line:1 char:1 + phython 2.py + ~~~~~~~ + CategoryInfo : ObjectNotFound: (phython:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException