Lab 4.2
1.Construct a program that will print out the value of the counter variable until the counter variable reaches 7
2.Include an if statement that will stop the loop once the counter variable reaches 4
3.Restart the loop so that the count continues until 7 is reached
4.Save the program as lab4.2 and submit it
(Use repl.it and use Python language
Display:
1
2
3
5
6
7
# 1.Construct a program that will print out the value of the counter variable until the counter variable reaches 7
counter = 1
while(counter<=7):
print(counter)
counter += 1
# 2.Include an if statement that will stop the loop once the counter variable reaches 4
counter = 1
while(counter<=7):
if(counter==4):
break
print(counter)
counter += 1
# 3.Restart the loop so that the count continues until 7 is reached
for count in range(1,8):
print(count)
Lab 4.2 1.Construct a program that will print out the value of the counter variable until...
USING MATLAB. Design a program which uses a for…end loop to add 10 to a variable V five times. Use a counter variable to count the number of iterations that pass and display this count after the program exits the loop. To design your program, create a flow chart and iteration table (choose he starting variable V = 20). Once it is designed, code it and step through the loop to confirm your iteration table.
In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while loop or a for loop to print only odd numbers 1, 3, 5, 7, 9 *tip: you can use range () function, or a condition with ‘break’ (e.g, while count < 10) In python!: Create a program that print out 12 months of a year and associated numbers (e.g., January 1, February 2…). Two lists should be created, and then loop through the list...
Create a new Python program in IDLE, and save it as lab8.py.(Again, I recommend saving lab progranms Your Python program will do the following: Create an empty list . Use a for loop to ask the user for 10 numbers. Add each number to your list using the append metha . Use another for loop to print the list in reverse order, one per line . Use a while loop to count how many positive numbers are in the list...
*** Using the computer program MultiSIM to complete this
assignment please ***
1. Construct a 6 position ring counter and output to a seven segment display outer LEDs (do not use center LED) 2. The lights should travel in a ring around the seven segment display 3. Hint: You do not want to use a BDC to seven segment decoder . Circuit will power up with one light on. 5. Pressing a switch will cause the ring counter to loop...
I need help with a C++ assignment: Write a program containing the following: 1. Variable Definitions only as (DieRoll, Guess, cnt1, cnt2) followed by this statement: srand((unsigned int)time (NULL)); which will give the random number generator a random starting point. Note: srand and rand require the TIME.H (or iomanip) cnt1 and cnt2 will be used in Chapter 5 drop box as counters for loops. Do NOT create additional variables. Points will be taken off for any additional variable creation. 2....
INSTRUCTION AND PROBLEMS Write a Python program for each of the problems in this lab. Please use PyCharm to type and test your programs. Submit the Python files to Blackboard for credit. In this lab, you should submit 4 Python files, one for each problem PROBLEM I Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bll. A power company charges customers $0.12 per kWh for...
Overview Module 3 Assignment 2 features designing a program using pseudocode and then completing the program in Python using strings. M3Lab2 asks you to write a Mortgage Loan Calculator. 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 Pseudocode and Python Program with Strings M3Lab2.txt has some of the...
[Using Python] Create a program to generate one random question, from a list of 5, for each repeated run. Report the number of the correct answers after all five questions have been answered. Your 5 questions should be a simple math problem, like "what is 5-4?" use a while loop based on the number of questions use a counter variable to count the number of questions asked e.g. questionCount +=1 user a counter variable to keep track of the correct...
using this code to complete. it python 3.#Display Program
Purpose
print("The program will show how much money you will make
working a job that gives a inputted percentage increase each
year")
#Declaration and Initialization of Variables
userName = "" #Variable to hold user's name
currentYear = 0 #Variable to hold current year input
birthYear = 0 #Variable to hold birth year input
startingSalary = 0 #Variable to hold starting salary
input
retirementAge = 0 #Variable to hold retirement age input...
Java Submit a program in a .java file. The program should print a multiplication table for the numbers 1-9. This requires a nested for loop. The outer loop moves from row to row, while the inner loop prints the row. Use tabs to separate the output, such as in the following statement: System.out.println(“1\t2\t3\t4\t5\t6\t7\t8\t9”); Output should look similar to the following. 1 2 3 4 5 6 7 8 9 ------------------------------------------------------------------ 1 2 3 4 5 6 7 8 9...