You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"A bug free program that behaves as intended looks like this:"
ERROR: The Ada solution has a typeError because the code does not compile in the Python 2.x used by Ada.
Which is still incorrect
Not typeError
INSTEAD
Syntax Error
WHY?
input() is used in Python 3.x
raw_input() is used in Python 2.x ***input was used instead of raw_input in the ADA problem
Additionally
print(f"That's a great age! I am {36 - age} years older than you")*** python 2.x Inaccurate
Why?
"f" for format is used in python 3.x not in python 2.x
ALSO
print(f"That's a great age! I am {36 - age} years older than you") ***python 3.x Accurate BUT inaccurate in python 2.x which ADA uses
Correct print in python 2.x:
print("That's a great age! I am " + str(36 - age) + " years older than you") ***python 3.x Accurate
WHY?
After converting age into an int from the input given by the user. You must convert the int (36 - age) into a string because you are adding "+" it to the string on the left side "Thats a great age! I am " and to the string on the right side " years older than you"
The updated code for Python 2x
**won't comply in the ADA code cell because we can't rewrite the code ourselves
** Does Comply in an online Python Complier
age = raw_input("How old are you? ")
age = int(age)
output the difference in your ages
print("That's a great age! I am " + str(36 - age) + " years older than you")
HOWEVER, the original code is accurate with Python 3.x ONLY **which ADA doesn't use
How old are you? 31
That's a great age! I am 5 years older than you
The text was updated successfully, but these errors were encountered:
The problem below these words:
"A bug free program that behaves as intended looks like this:"
ERROR: The Ada solution has a typeError because the code does not compile in the Python 2.x used by Ada.
Which is still incorrect
Not typeError
INSTEAD
Syntax Error
WHY?
input() is used in Python 3.x
raw_input() is used in Python 2.x ***input was used instead of raw_input in the ADA problem
Additionally
print(f"That's a great age! I am {36 - age} years older than you")*** python 2.x Inaccurate
Why?
"f" for format is used in python 3.x not in python 2.x
ALSO
print(f"That's a great age! I am {36 - age} years older than you") ***python 3.x Accurate BUT inaccurate in python 2.x which ADA uses
Correct print in python 2.x:
print("That's a great age! I am " + str(36 - age) + " years older than you") ***python 3.x Accurate
WHY?
After converting age into an int from the input given by the user. You must convert the int (36 - age) into a string because you are adding "+" it to the string on the left side "Thats a great age! I am " and to the string on the right side " years older than you"
The updated code for Python 2x
**won't comply in the ADA code cell because we can't rewrite the code ourselves
** Does Comply in an online Python Complier
age = raw_input("How old are you? ")
age = int(age)
output the difference in your ages
print("That's a great age! I am " + str(36 - age) + " years older than you")
HOWEVER, the original code is accurate with Python 3.x ONLY **which ADA doesn't use
How old are you? 31
That's a great age! I am 5 years older than you
The text was updated successfully, but these errors were encountered: