Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS WRITTEN IN PYTHON >>IS A HIGH SCHOOL COMPUTER SCIENCE COURSE. NOT TOO COMPLICATED PLEASE QUESTION #1 Write code to output the ASCII characters

THIS IS WRITTEN IN PYTHON >>IS A HIGH SCHOOL COMPUTER SCIENCE COURSE. NOT TOO COMPLICATED PLEASE

QUESTION #1

Write code to output the ASCII characters that are represented by the numbers from 45 to 85, one per line.

Expected Output

- . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U

QUESTION #2

Write a program that asks the user to enter a single character and then outputs the ASCII number of that character. Please follow the same format as in the sample run.

Try it: What happens if you type in a word like paper?

Sample Run

Enter a character: % ASCII #37 Enter a character: 8 ASCII #56

QUESTION #3

In the last problem, we get an error if we enter more than one character at a time. Rewrite the program so that it only calls the chr method if a single character is entered.

Sample Run

Enter a character: * ASCII #42 Enter a character: exit Not a character

QUESTION #4

Write a program that asks the user to input a word or phrase and then outputs the following information about that phrase:

  1. "All numbers", if the input is all numbers.
  2. "Does not contain numbers", if the input does not contain any numbers.
  3. "Contains a {digit}" for each number in the phrase.

Sample Run

Enter your word or phrase: 555 All numbers Enter your word or phrase: We are #1! Contains a 1 Enter your word or phrase: a1b2c3d Contains a 1 Contains a 2 Contains a 3 Enter your word or phrase: computer science Does not contain numbers

HINT 1: you may wish to use a loop that goes from the digits 0 to 9, and remember that loops can be used for processing string values when appropriate.

HINT 2: In order to at the end see if any numbers have been found, you can create a true-false variable that is initialized before your for loop, and use an if/else statement inside of that loop that modifies the variable if any numbers have been found. Variables used in this fashion are called flag variables.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions