python-3.4

    0熱度

    1回答

    我想問用戶2個問題。他們應該回答大於0的數字,但如果他們回答像1,0或可能是0,1這仍然是一個有效的答案。如果他們用0回答這兩個問題,那麼程序將終止。我在哪裏錯了,因爲我一直堅持了一個多小時。 a = 1 b = 1 while a > 0 and b > 0: a = float(input("Enter A: ")) b = float(input("Enter B

    0熱度

    2回答

    我有連接兩個字符串的代碼,但它向我顯示一個錯誤。 下面是代碼: Name = "Praveen kumar" print (Name)+"Good boy" 錯誤消息:unsupported operand type(s) for +: 'NoneType' and 'str' 我該如何解決這個問題?

    -1熱度

    2回答

    所以我想製作一個程序,使用def來查找階乘。 改變這一點: print ("Please enter a number greater than or equal to 0: ") x = int(input()) f = 1 for n in range(2, x + 1): f = f * n print(x,' factorial is ',f) 到 的東西,使用高清

    0熱度

    1回答

    假設我有一類叫做主題: class Subject(): def __init__(self, name, longName): self.name = name self.long_name = longName def __repr__(self): return self.long_name + "(" + self.name + "

    0熱度

    1回答

    成功安裝Python後,我找不到pip可執行文件。 的/usr/local/lib/python3.4/site-packages/pip的內容是: -rw-r--r--. 1 root root 9450 Oct 26 10:29 __init__.py -rw-r--r--. 1 root root 116 Oct 26 10:29 __main__.py -rw-r--r--. 1 ro

    0熱度

    2回答

    我想打開一個窗口,焦點設置爲第一個按鈕,所以我不必選中它。 如果物件是一款入門小部件,我可以寫 widget_name.focus() 似乎沒有成爲一個按鈕控件的等價物。

    -2熱度

    2回答

    我已經完成了一個練習程序。它打印得非常好,但問題是輸出的最後三行不準確。每次運行程序時,它都會生成不同的輸出,並在鍵之間交替。我不能找到一個辦法把它出來的權利(如寫入的程序中) def main(): zip_dictionary = {} zip_dictionary = update_dictionary(zip_dictionary, "CAM", "1427")

    0熱度

    2回答

    這只是給我的第一個字一個字符串,我需要沒有數字返回: def stripNonLetters(aString): words=[] aString=aString.lower() for word in aString: if word.isalpha() or word.isspace(): words.append(word) print(words) ret

    -1熱度

    1回答

    如何將變量x存儲在文本文件中的特定行(第一個)上,並在程序打開時將其恢復。 而且如何將我存儲在特定的行

    6熱度

    1回答

    >>> print(len.__doc__) len(module, object) Return the number of items of a sequence or mapping. >>> len(os, 1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeErr