+ 2
What is the output of this code? >>> spam = "7" >>> spam = spam + "0" >>> eggs = int(spam) + 3 >>> print(float(eggs))
What is the output of this code? >>> spam = "7" >>> spam = spam + "0" >>> eggs = int(spam) + 3 >>> print(float(eggs))
11 Antworten
+ 12
spam contains "7" concatenated with "0", which is "70". eggs contain "70" casted to integer and added with 3, which is 73. eggs is casted to float and printed.
Outputs 73.0
+ 2
It's a string, concatenated to another. Then converted to a number?
... hmm, 73.0 I'd wager.
+ 1
73.0
0
73.0
0
73.0
0
73.0
0
output is:
73.0
0
spam = "7"
spam = spam + "0"
eggs = int(spam) + 3
print(float(eggs))
0
3
41 Comments
What's the output of this code if the user enters '42' as input:
age = int(input())
print(age+8)
0
3
41 Comments
What's the output of this code if the user enters '42' as input:
age = int(input())
print(age+8)
0
3
41 Comments
What's the output of this code if the user enters '42' as input:
age = int(input())
print(age+8)