Is it possible to get another output in string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to get another output in string?

x=int(7) print(x) y=int(input()) print(y) z=(float(x)*int(y)) print(z) After inputting your "y value", is it still possible get z as a float string value? Like, is that even possible?

1st Apr 2020, 10:57 AM
Isaac
Isaac - avatar
5 Answers
0
Try it on the playground,.. By adding, print(str(z))
1st Apr 2020, 11:12 AM
Jayakrishna 🇮🇳
0
What if I want to add quotation marks (") to the output of z?
1st Apr 2020, 11:15 AM
Isaac
Isaac - avatar
0
Jayakrishna🇮🇳 because, since it's now a string output, I should be able to add quotation marks, right??
1st Apr 2020, 11:20 AM
Isaac
Isaac - avatar
0
No. If z="hello" print(z) print("z") Output is : hello z "", or ' ' are used to create a string... Like "world" =>is a string but without quotes, world => is a variable can hold a value..
1st Apr 2020, 11:26 AM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 Alright. Thanks man. I was already thinking of escaping the quotations (\") to make that possible. But thanks for clearing that up.
1st Apr 2020, 11:31 AM
Isaac
Isaac - avatar