How can I make these codes not be associated with a single output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make these codes not be associated with a single output

x=int(6+3) print (str(x)) x=int(11+22) print (str(x))

21st Mar 2021, 6:17 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
28 Answers
+ 1
you are trying to substitute ready-made values into a variable. Instead you should write a generic code like, a=int(input()) b=int(input()) x=a+b Print (str(x))
23rd Mar 2021, 4:46 AM
soumya shekhar
soumya shekhar - avatar
+ 4
Please, show us your code attempt
21st Mar 2021, 6:48 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 4
W h e r e i s y o u r c o d e???
21st Mar 2021, 6:51 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 3
What do you mean by assiciated with a single output?
21st Mar 2021, 6:20 AM
Slick
Slick - avatar
+ 3
tell us what you're trying to do? solve this simple calculator problem #18?
21st Mar 2021, 6:46 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 3
you are acting incorrectly. you are trying to substitute ready-made values into a variable. don't do that. the test program itself will substitute them for you. all you need to do is create two empty variables, add them, and display the result on the screen
21st Mar 2021, 7:24 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
In the eighteenth task, do not perform two actions. you only need one operation, so half of the code can be removed
21st Mar 2021, 6:54 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
and you should have two variables, under two numbers. each variable must contain its own number
21st Mar 2021, 6:55 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
You solved?
21st Mar 2021, 7:44 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Don't use str(x). Instead just type print(x) Also if you want to get user input use this: x=input() print(x)
22nd Mar 2021, 3:02 PM
Ava
Ava - avatar
+ 1
works as expected, here's your code without clutter. Not sure what the issue is. https://code.sololearn.com/cns892gXmWc0/?ref=app
21st Mar 2021, 6:34 AM
Slick
Slick - avatar
+ 1
he probably means how to enter the values himself. rather than using ready-made ones - "single output".
21st Mar 2021, 6:36 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Not resolved
21st Mar 2021, 7:12 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
+ 1
Thanks for these answer
21st Mar 2021, 7:40 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
+ 1
Yes
21st Mar 2021, 7:45 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
+ 1
Python is an untyped language so better avoid unnecesary conversions... x=6+3 print(x) x=11+22 print(x) If you need get some input as number then yes... n=int(input()) print (n+10)
23rd Mar 2021, 1:15 AM
David Ordás
David Ordás - avatar
+ 1
soumya shekhar only one thing... the str(x) it's unnecessary so... print (x)
23rd Mar 2021, 3:06 PM
David Ordás
David Ordás - avatar
0
In the output, these codes are in one output, and in the Python course projects, each code should have only one output
21st Mar 2021, 6:25 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
0
Okay, would you mind sharing the course project you're on? I'm still not sure what the peoblem is. Is it that it prints on seperate lines? What's your main issue?
21st Mar 2021, 6:29 AM
Slick
Slick - avatar
21st Mar 2021, 6:32 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar