EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Need help fixing my python code! Images attached on the required modficications I dont know how to do. Simpler the better.
Code: (in images)
Transcribed Image Text:name = input ("Enter your name: ")
ascii_decimal_values
= [ord (letter) for letter in name]
ascii_binary_values = [format (ord (letter), '08b') for letter in name]
print (f"In text name is: {' '.join(name)}")
print (f"In ASCII decimal: {' '.join (map (str, ascii_decimal_values))}")
print (f"In ASCII binary: {' '.join (ascii_binary_values)}")
age_str = input ("Enter your age: ")
age_int int (age_str)
age_ascii_decimal = [ord (digit) for digit in age_str]
age_ascii_binary = [format (ord (digit), '07b') for digit in age_str]
print (f"As a string \"{age_str}\": {' '.join (age_str)}")
print (f"In ASCII decimal: {' '.join (map (str, age_ascii_decimal))}")
print (f"In ASCII binary: {' '.join(age_ascii_binary)}")
print (f"As an int variable: (age_int}")
print (f"In numeric binary: {format (age_int, 'b')}")
Transcribed Image Text:Want output to look like the below:
Bob each character in fixed width
66 111 98 ASCII decimal for each letter
1000010 1101111 1100010 binary ASCII decimal below that
Add width of 7 to the program we just did as below:
print(f'{letter:^7} in ASCII decimal is {asciiLetter: ^7}')
Run and then change the above print into two prints as:
print(f'{letter:^7}')
print(f'{asciiLetter:^7}')
Run then add the ASCII decimal binary to really see columns
print(f'{asciiLetter:^7b}')
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps with 2 images
Knowledge Booster
Background pattern image
Recommended textbooks for you
- Text book imageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTText book imageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningText book imageNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
- Text book imageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LText book imageSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningText book imageNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage