0
I need help. I don't understand why it prints 0 instead of float number. Should i maybe use double?
7 Antworten
+ 2
You can change the 180 to 180.00. None of your numbers are decimals so the wynik is not registering properly as a float (same for double).
+ 1
Justice I think in python he can do 180/7 or whatever, he doesn't have to do a type conversion or add negative decimal places to do the deed.
Nice to get a glimpse of the differences in other languages beforehand. I guess the huge difference awaiting getting used to is var declaration in other lang's
+ 1
Korkunç the Terrible Frusciante Yeah, Python is an exception. But it also raises problem with python especially when unit testing and making sure to use correct variable types. Because if you then later wanted to convert the float without the decimals (so a float), you have to remember to convert it yourself rather than it automatically bring done at runtime.
0
Whenever you want to use a float or double, you have to make on of the values a decimal number even if it's just adding .00 . This is true for most programming languages.
0
So before the whole equation i have to add value to variable wynik?
0
OMG thanks that works XD
0
Glad to help. 😁