斯派德反应迟钝

2024-09-27 20:17:06 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我将Spyder IDE用于python。它停止执行我的代码,我试着只运行几行代码,但仍然没有响应。 有熟悉这类问题的人吗

#Assinging Variables
ProductName = "iPhone"
ProductPrice = 450
Tax = 0.5 #Tax is a constant that cannot be changed

print(ProductTax)


#Dealing with Inputs

name = input("Your Name")
print(name)

print("Hello", name)

city = input("Where do you live?")

print(name, "lives in", city)

#CASTING - converting one data type to another as examples below.

##Note that all the answers required below will be in form of strings
ProductName = input("what is the product Name?") 
ProductPrice = float(input("how much is it cost?")) #the string is converted to float
ProductQuantity = int(input("How many?")) #the string is converted to an integer

TotalPrice = ProductQuantity*ProductPrice
print("Total Price: ", TotalPrice)


##SELECTION
## selection is used to choose between 2 or more otions in programming
## if statements is a type of 'selection'

#weather = input("is it raining")
#if weather == "raining":
    #print ("Grab an Umbrella")
#else:print("Wear a coat")

Tags: theto代码nameincityinputthat

热门问题