Assignment 2 Introduction To Computing
Assignment 2 Introduction To Computing
Assignment 2
a = 3
b = 2
if a > b:
print("a is greater than b")
print(a*b)
Kingdom of Saudi Arabia المملكة العربية السعودية
Ministry of Education وزارة التعليم – جامعة جازان
Jazan University كلية علوم الحاسب و تقنية المعلومات
College of Computer Science &
Information Technology
Question 3) write a program that use a while loop to display the following output:
The Output:
10
8
6
4
2
0
Kingdom of Saudi Arabia المملكة العربية السعودية
Ministry of Education وزارة التعليم – جامعة جازان
Jazan University كلية علوم الحاسب و تقنية المعلومات
College of Computer Science &
Information Technology
lowest_value= 200
print('before',lowest_value)
for x in [190,250,100,50,10,150,30]:
if x < lowest_value:
lowest_value = x
print('current lowest value: ',lowest_value, 'current for element: ', x)
print('the lowest value is ', lowest_value)
Question 5) find the four errors in the following code and rewrite the code.
found = False
print('Before, found)
for x in [8,41,66,3,40,75,15]
if x = 3:
found = True
print found, x)
print('after', found)
Kingdom of Saudi Arabia المملكة العربية السعودية
Ministry of Education وزارة التعليم – جامعة جازان
Jazan University كلية علوم الحاسب و تقنية المعلومات
College of Computer Science &
Information Technology