簡體   English   中英

編寫一個程序,要求用戶輸入一個字符串,然后以大寫形式打印該字符串

[英]Write a program that asks the user for a string and then prints the string in upper case

我正在自學編程語言(CEMC Python 從頭開始​​),這是我的第一門編程語言。 我花了三個多小時來解決這個問題。 請幫助解決這個問題,這樣我就可以知道我做錯了什么。

# python 2.x
>>>text = raw_input()
# python 3.x
>>>text = input()
>>>print(text.upper())
# script.py

string = input("write a string ")

print(string.upper())

我在 python 上對其進行了測試,它可以工作:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM