What's wrong with my code? PYTHON # FIXME (1): Finish reading other items into variables, then output the four values on

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

What's wrong with my code? PYTHON # FIXME (1): Finish reading other items into variables, then output the four values on

Post by answerhappygod »

What's wrong with my code? PYTHON
# FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space
user_int = int(input('Enter integer (32 - 126):\n'))user_float = float(input('Enter float:\n'))user_char = input('Enter character:\n')user_str = (input('Enter string:\n'))
print(user_int,user_float,user_char,user_str)
# FIXME (2): Output the four values in reverse
user_int = int(input('Enter integer (32 - 126):\n'))user_float = float(input('Enter float:\n'))user_char = input('Enter character:\n')user_str = (input('Enter string:\n'))
print(user_int,user_float,user_char,user_str)print(user_str,user_char,user_float,user_int)# FIXME (3): Convert the integer to a character, and output that character
user_int = int(input('Enter integer (32 - 126):\n'))character = chr(user_int)print('Character of ',user_int,' is ',character)
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 1
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 1 (47.16 KiB) Viewed 11 times
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 2
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 2 (29.59 KiB) Viewed 11 times
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 3
What S Wrong With My Code Python Fixme 1 Finish Reading Other Items Into Variables Then Output The Four Values On 3 (31.78 KiB) Viewed 11 times
(1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (Submit for 2 points). Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs. Enter integer (32 - 126): 99 Enter float: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy (2) Extend to also output in reverse. (Submit for 1 point, so 3 points total). Enter integer (32 126): 99 Enter float: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 (3) Extend to convert the integer to a character by using the 'chr()' function, and output that character. (Submit for 2 points, so 5 points total). Enter integer (32 - 126): 99 Enter float: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 99 converted to a character is c
3: Compare output Traceback (most recent call last): File "main.py", line 13, in user_int EOFError: EOF when reading a line Output differs. See highlights below. 99 3.77 Input int (input('Enter integer (32 - 126):\n")) Your output starts with Expected output starts with Howdy Enter integer (32 126) Enter float: Enter character: Enter string: 99 3.77 z Howdy Enter integer (32 Enter integer (32 - 126): Enter float: Enter character: Enter string: 99 3.77 z Howdy Howdy z 3.77 99 0/1
4: Compare output Traceback (most recent call last): File "main.py", line 13, in user_int - int (input('Enter integer (32-126):\n')) EOFError: EOF when reading a line Output differs. See highlights below. Special character legend Input Your output Expected output 99 3.77 Howdy Enter integer (32 - 126) : Enter float: Enter character: Enter string: 99 3.77 z Howdy Enter integer (32 126): Enter integer (32 - 126) : Enter float: Enter character: Enter string: 99 3.77 z Howdy Howdy z 3.77 99 99 converted to a character is c 0/1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply