BG Development


  Reply to this topicStart new topicStart Poll

> Какво се случва? | Python, str();, не вдявам
WorldUPP
Публикувано на: 28-10-2022, 17:20
Quote Post



Име:
Група: Потребител
Ранг: Новопостъпил

Мнения: 17
Регистриран на: 28.10.22



Привет,
радвам се да съм част от общността!

Може ли отговор защо този код дава този output:

THE CODE:
CODE
v1 = 0;
v2 = 0;
v3 = 0;
def getValues():
   v1 = input("Enter the down-left vertex number:");
   v2 = input("Enter the down-right vertex number:");
   v3 = input("Enter the top vertex number:");
def printValues():
   sv1 = str(v1);
   sv2 = str(v2);
   sv3 = str(v3);
   print("The left vertex is:" + sv1 + ", the right vertex is:" + sv2 + "and the top vertex is:" +sv3);
getValues();
printValues();


OUTPUT:
CODE
Enter the down-left vertex number:2
Enter the down-right vertex number:3
Enter the top vertex number:4
The left vertex is:0, the right vertex is:0and the top vertex is:0


Благодар́я предварително!


--------------------
is anarchy the key to peace?
faith is the only thing that keeps you in between your changing moods.
PMEmail Poster
Top
thrawn
Публикувано на: 28-10-2022, 18:40
Quote Post



Име:
Група: Потребител
Ранг: Почетен член

Мнения: 3506
Регистриран на: 17.01.17



Виж как се използват глобалните променливи в питон.
PMEmail Poster
Top
WorldUPP
  Публикувано на: 28-10-2022, 19:00
Quote Post



Име:
Група: Потребител
Ранг: Новопостъпил

Мнения: 17
Регистриран на: 28.10.22



QUOTE (thrawn @ 28-10-2022, 18:40)
Виж как се използват глобалните променливи в питон.

Евалата, благодаря ти!


--------------------
is anarchy the key to peace?
faith is the only thing that keeps you in between your changing moods.
PMEmail Poster
Top
0 потребители преглеждат тази тема в момента (0 гости, 0 анонимни потребители)
Потребители, преглеждащи темата в момента:

Topic Options Reply to this topicStart new topicStart Poll

 


Copyright © 2003-2019 | BG Development | All Rights Reserved
RSS 2.0