Week 4: Jan 30
Lab3 – Professor Azzad Kara
Due: Feb 06, 2023
___________________________________________________________________________________________
Write the following Python Programs and upload to Blackboard.
Code each question separately.
At the beginning of each question in your Python code, please provide the following:
Author: Firstname Lastname
Student ID:
Date:
I declare that this lab is my own work in accordance with Seneca Academic Policy. No part of this lab has been
copied manually or electronically from any other source (including web sites) or distributed to other students.
___________________________________________________________________________________________
1) Using a while-loop, write a Python Program to print the pattern shown below:
1010101
10101
101
1
2) Write the following Python Program:
Using a while loop print the binary value of the positive integer.
Accept as input only a positive integer number from the user.
Your program should not accept a negative number or a floating-point number.
• If either a negative number or a floating-point number has been input,
the user should be prompted to enter another number.
• Using a while loop, print a binary value of the positive integer.
3) Use a for- loop to check if the given input string is a palindrome.
• Note: a string is said to be a palindrome if the reverse of the string is the same as the input
string.
• For example, the string radar is a palindrome.
If the input string is a Palindrome:
Print the output “The string, input-string, “is a Palindrome.”
Otherwise:
Print the output ““The string, input-string, “is a NOT Palindrome.”
4) InfoSen has the following employees as shown in the chart below.
The salary column is the annual for 2022.
i. Create a Python program to calculate the average salary for 2022 and output the result:
“The average annual salary for 2022 is: $ .
ii. In 2023, InfoSen increased the salary by 5% for all their employees listed in the chart.
a. Create a Python program to output:
i. The increased amount of salary for each employee in 2023
ii. The total salary for each employee in 2023
iii. The average annual salary for 2023
Employee ID Firstname Lastname Salary
101 Vijay Acharya 55100
102 Sheila James 45000
103 Wang Li 56000
104 Amir Hussain 68600
105 Joseph Adam 45200
106 Preeti Vijayakumar 57900
107 Alonto Abad 46300
108 Shawn Cossington 49600
109 Sameer Ahmed 40900
___________________________________________________________________________________