question_answer = [
'Сколько сейчас времени?': [t: "time", text: "Сейчас: "],
'Дата': [t: "date", text: "Cегодня у нас: "],
'Анекдот': [t: "text", text: "Анекдот ..."],,
]
try:
question = input("Введите запрос: ")
answer = question_answer[question]
if answer['t'] == "time":
engine.say(answer['text'] + str(time))
if answer['t'] == "date":
engine.say(answer['text'] + str(date))
if answer['t'] == "text":
engine.say(answer['text'])
engine.runAndWait()
except KeyError:
engine.say("Неизвестная комманда")
engine.runAndWait()
package main
import "fmt"
type Shape interface {
Area() float64
ShowSide() float64
}
type ShapeOriginal struct {
Side float64
}
type ShapeCube struct {
ShapeOriginal
}
func (s ShapeOriginal) Area() float64 {
return s.Side * s.Side
}
func (s ShapeOriginal) ShowSide() float64 {
return s.Side
}
func (s ShapeCube) Area() float64 {
return 6 * (s.Side * s.Side)
}
func main() {
origShape := ShapeOriginal{Side: 6}
fmt.Println("Original Shape")
fmt.Println(origShape.Area())
fmt.Println(origShape.ShowSide())
cubeShape := ShapeCube{ShapeOriginal{Side:6}}
fmt.Println("Cube Shape")
fmt.Println(cubeShape.Area())
fmt.Println(cubeShape.ShowSide())
}