Question

CS-320 -- Programming Exercise 1 Create a program in Python that rewrites the following pseudocode segment...

CS-320 -- Programming Exercise 1

Create a program in Python that rewrites the following pseudocode segment using a loop structure:

       k = (j + 13) / 27
    loop:

if k > 10 then goto out k = k + 1
i = 3 * k – 1
goto loop

out: ...

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In Python:

k = (j + 13) / 27
while k > 10:  #The While loop iterates till k is greater than 10
    k += 1
    i = 3 * k - 1

#Here the assignment of i is done outside of the while loop as assigning the value of i each time

#the iteration is done is pointless.

#outside of the loop a final value of k is obtained which is then used to find and then store value 'i'.

Add a comment
Know the answer?
Add Answer to:
CS-320 -- Programming Exercise 1 Create a program in Python that rewrites the following pseudocode segment...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume...

    A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume that all the variables are declared and initialized. k-G+ 13)/27 loop: if k> 10 then goto out k=k+1 i=3"k-1 goto loop I out: B) Rewrite the following code segment in C++ using the multiple-selection (switch and if-else) statements. Assume that all the variables are declared and initialized. if((k 1) || (k 2))j-2 k-1 if ((k 3) || ( ks))j - 3.k+1 if (k 4)j-4k-1...

  • ((python programming)) 2. In this exercise you will create a program that reads a letter of...

    ((python programming)) 2. In this exercise you will create a program that reads a letter of the alphabet from the user. If the user enters a, e, i, o or u then your program should display a message indicating that the entered letter is a vowel. If the user enters y then your program should display a message indicating that sometimes y is a vowel and sometimes y is a consonant. Otherwise your program should display a message indicating that...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • pseudocode and Python Repl.it :Recall that Programming Exercise 3 in Chapter 8 asked you to design...

    pseudocode and Python Repl.it :Recall that Programming Exercise 3 in Chapter 8 asked you to design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Enhance the program so it sorts the array in ascending order and displays the values it contains.

  • Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As...

    Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As the family cook, you know that the toughest question of the day is "What's for dinner?" You For decide to write a program to help you do days of meal planning for the entree, side and dessert. You will need to use random numbers and functions to complete the project. What's Dinner? • • • Start with a pseudocode (10 points). Write the pseudocode...

  • QUESTION 25 Examine the following program segment. Assuming the array table has values in it, what...

    QUESTION 25 Examine the following program segment. Assuming the array table has values in it, what is the correct outcome? double table [10] [2], sum=0.0; int i, j, nrows=10; for(i=0; i<=nrows-1; i++) sum += tableta (3); It will sum the table values in the rows only. It will sum the table values in the columns only. It will not sum the table values because nrows is too small. It will not sum the table values because the columns are not...

  • java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you...

    java programming: Convert the following PSEUDOCODE into a java program. For this problem I'm giving you the pseudocode and you are writing the program, in later problems you will write both the pseudocode and the java program. This means for this program pseudocode is NOT required. Pseudocode to convert to a java program: Create variables: speed, time and distance Store 20 in the variable speed Store 10 in the variable time Multiply speed * time and store the result in...

  • Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that...

    Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that uses iteration to guess a number from 1 to 10. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Write pseudocode for a Python program that uses iteration to guess a number from...

  • Your mission in this programming assignment is to create a Python program that will take an...

    Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents.   Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...

  • RASPBERRY Pi 3 / SENSE HAT! Part I - Create a python program that prompts the...

    RASPBERRY Pi 3 / SENSE HAT! Part I - Create a python program that prompts the user to enter a number between 1 and 5. Then the program will light up a dot at various location depending on the value of the input. This will be using control-flow if-elif-else that we covered in class this week: Control Flow - If and Else. 1 = top left corner 2 = top right corner 3 = bottom left corner 4= bottom right...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT