В вашем коде есть некоторые ошибки:
float
для лучшего расчета. else
. См. Документацию Попробуйте следующий код:
print("1 rectangle")
print("2 squared")
print("3 circle")
shape = input (">> ")
if shape == 1:
length = float(input ("What is the length of the rectangle?"))
breadth = float(input ("What is the breadth of the rectangle?"))
area = length * breadth *2
print ("the area of your rectangle", area)
elif shape == 2:
length = float(input ("what is the length of one side of the squared"))
area = length * length
print ("the area of your square is ", area)
else:
radius = float(input ("what is the radius of your circle"))
area = radius *radius*3.14
print ("area of your circle is ", area)
Надеюсь, что это отвечает на ваш вопрос !!!
Ваши значения находятся в диапазоне от 0 до 255. Используйте их для создания UIColor:
float r; float g; float b; float a;
[UIColor colorWithRed:r/255.f
green:g/255.f
blue:b/255.f
alpha:a/255.f];