Объяснение:
Итак, было 2 места с опечатками.
Во-первых, строка 29 - ввод числа - действия. Стоял плюс перед input(). option = +input(...
Во-вторых, строка 34 - вывод результата сложения, результат суммы не присоединялся к строке (забыт оператор +).
Исправил и приложил код ниже.
P.S. Вообще тема калькуляторов - вещь интересная. Она стоит на границе двух областей: компиляторов (парсинг, синтаксический анализ, etc.) и символьных вычислений (Это про то, как по текстовому выражению решить дифференциальное уравнение или построить график функции, или решить квадратное уравнение аналитически).
Если тебя так интересует эта тема, можешь продолжить написанием более функционального калькулятора для обратной польской записи, например.
Успехов в обучении!
Код:
like = "Great, I'm too! So let's enjoy math together)"
hate = "But I do like! So I can help you as well)"
what = "Could you please answer Yes or No)"
anyway = "Although I can't understand you again, let's do this!"
option = "6"
i = "7"
name = input("Hey, what's your name? ")
print("Wow, what a beautiful name ")
math = input(name + ", do you like mathematics? ")
if math.lower() == "yes":
print(like)
elif math.lower() == "no":
print(hate)
else:
print(what)
print(" ")
math = input(name + ", do you like mathematics? ")
if math.lower() == "yes":
print(like)
elif math.lower() == "no":
print(hate)
else:
print(anyway)
print(" ")
while i == "7":
print("I can find the sum(1), difference(2), product(3), fraction(4), of two numbers and raise number to the power(5) or end this game(0)")
option = input("select the needed option by sending corresponding number ") # HERE! You have placed a plus before an input()
if option == "1":
n1 = float(input("So you have chosen the sum. Enter the first number "))
n2 = float(input(f"And what number you wanna add to {n1} ? "))
sum = n1+n2
print(f"The sum of {n1} and {n2} is {sum}") # And THERE! You have written down ... + "is" sum) without a concatination plus
print(" ")
elif option == "2":
n1 = float(input("So you have chosen the difference. Enter the first number "))
n2 = float(input("And the second? "))
dif = n1 - n2
print(f"{n1} - {n2} = {dif}")
print(" ")
elif option == "3":
n1 = float(input("So you have chosen the production. Enter the first number "))
n2 = float(input("And the second one "))
prod = n1 * n2
print(f"The result is {prod}")
print(" ")
elif option == "4":
n1 = float(input("So you have chosen the fraction. Enter the first number "))
n2 = float(input(f"And {n1} is divided by... "))
fr = n1 / n2
print(f"So, the result is {fr}")
print(" ")
elif option == "5":
n1 = float(input("What number should I raise to the poser? "))
n2 = float(input(f"And what is exponent (the little number above {n1}) ? "))
power = n1 ** n2
print(f"{n1}^{n2} is {power}")
print(" ")
elif option == "0":
input("The game is ended!")
break
else:
print("I don't have any options like this. Try again.")
С вероятнее всего, вы написали свой скрипт по каким то старым гайдам, информация в которых давным давно устарела. В текущей версии API OpenWeatherMap объект OWM не имеет атрибута weather_at_place()
В текущей версии API объект OWM имеет метод weather_manager(), возвращающий WeatherManager. Уже у этого объекта мы можем вызвать метод weather_at_place(), который опять же вернёт нам очередной объект, Observation. У Observation мы можем обратиться к атрибуту weather, уже у которого вызываем метод temperature(unti), который нам наконец-таки вернёт словарь с данными о температуре в указанной области.
Пример рабочего скрипта:
#Python 3.8.3 pyowm 3.0.0
import settings #Я храню все API и прочее в отдельном .py файле
import pyowm
API_KEY = settings.PYOWM_APIKEY #Получаем API_KEY из файла настроек
owm_obj = pyowm.OWM(API_KEY) #Создаём экземпляр OWM
city = input('Enter city to get weather:\n')
#Получаем WeatherManager
weather_manager = owm_obj.weather_manager()
#Получаем Observation в для указанного city:
obs = weather_manager.weather_at_place(city)
#Обращаемся к атрибуту weather объекта obs (Observation) и #вызываем метод temperature, тем самым получая заветные данные о #температуре. В квадратных скобках указываем ключ 'temp', что бы #получить только данные о текущей температуре:
temperature_at_selected_place = obs.weather.temperature(unit='celsius')['temp']
print(f'{temperature_at_selected_place}')
B:[1..100] of Integer;
i,j,N,M:integer;
begin
Readln(N,M);
For i:=1 to N do
For j:=1 to M do
A[i,j]:=Random(0,3);
For i:=1 to N do
begin
For j:=1 to M do
Write(A[i,j];
Writeln;
end;
For i:=1 to N do
For j:=1 to M do
If (A[i,j]=1) or (A[i,j]=2) then
B[j]:=B[j]+1;
For i:=1 to M do
Write(B[i],' ');
end.