💻Visual📡Time📸
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Building the Prototype</title> <link rel="stylesheet" href="styles.css"> </head> <body> <div id="container"> <h1>Leopard</h1> <!-- photo credit: wikipedia.org, image taken by Ritik…
ask 1:
You are required to complete the function reverse(x). given a string "x" as an input it is expected to return that same string but reversed.
Example:
input : "again"
output: "niaga"
you can change the string value in the variable text but you are not allowed to change the variable names or edit any other code,
except the function's body, doing so may jeopardize your evaluation
sol1----------------------
text = "this is not a reversed text"
def reverse(x):
#complete this function so that it takes string x as an input
#and returns its reverse
return x[::-1]
print("the reversed text is: "+reverse(text))
--------------------------------------------------------------------------------------------
Task 2:¶
You are required to complete the function average(x). where "x" is a list of numbers, and contains more than 3 numbers. the function is expected to return the average from that list.
Example:
input : [10,20,30,40]
output: 25
you can change the numbers in the list no_list but you are not allowed to change the variable names or edit any other code,
except the function's body, doing so may jeopardize your evaluation
sol2------------------------------------
no_list = [22,68,90,78,90,88]
def average(x):
#complete the function's body to return the average
sum = 0
for e in x:
sum += e
return sum / len(x)
print(average(no_list))
--------------------------------------------------------------------------------
Task 3:¶
You are required to complete the function maximum(x). where "x" is a list of numbers, and contains more than 2 numbers. the function is expected to return the highest number in that list.
Example:
input : [5,20,12,6]
output: 20
you can change the numbers in the list no_list but you are not allowed to change the variable names or
edit any other code, except the function's body, doing so may jeopardize your evaluation*
sol3-------------------------------------------
no_list = [1,2,3,4]
def maximum(no_list):
#complete the function to return the highest number in the list
high = no_list[0]
for e in no_list:
if e > high:
high = e
return high
print(maximum(no_list))
------------------------------------------------------------------------------
Task 4:¶
You are required to complete the function unique_list(l). where "l" is a list of numbers. the function is expected to return the unique numbers in that list.
Example:
input : [1,1,1,2,2,3,3,3,3,4,5,5,6]
output: [1,2,3,4,5,6]
you are not allowed to change the variable names or their values or edit any other code, except the function's body, doing so may jeopardize your evaluation
sol4------------------------
no_list = [22,22,2,1,11,11,2,2,3,3,3,4,5,5,5,55,55,66]
def unique_list(l):
#complete the function's body to return the unique list of numbers
unique = []
for x in l:
if x not in unique:
unique.append(x)
return unique
print(unique_list(no_list))
You are required to complete the function reverse(x). given a string "x" as an input it is expected to return that same string but reversed.
Example:
input : "again"
output: "niaga"
you can change the string value in the variable text but you are not allowed to change the variable names or edit any other code,
except the function's body, doing so may jeopardize your evaluation
sol1----------------------
text = "this is not a reversed text"
def reverse(x):
#complete this function so that it takes string x as an input
#and returns its reverse
return x[::-1]
print("the reversed text is: "+reverse(text))
--------------------------------------------------------------------------------------------
Task 2:¶
You are required to complete the function average(x). where "x" is a list of numbers, and contains more than 3 numbers. the function is expected to return the average from that list.
Example:
input : [10,20,30,40]
output: 25
you can change the numbers in the list no_list but you are not allowed to change the variable names or edit any other code,
except the function's body, doing so may jeopardize your evaluation
sol2------------------------------------
no_list = [22,68,90,78,90,88]
def average(x):
#complete the function's body to return the average
sum = 0
for e in x:
sum += e
return sum / len(x)
print(average(no_list))
--------------------------------------------------------------------------------
Task 3:¶
You are required to complete the function maximum(x). where "x" is a list of numbers, and contains more than 2 numbers. the function is expected to return the highest number in that list.
Example:
input : [5,20,12,6]
output: 20
you can change the numbers in the list no_list but you are not allowed to change the variable names or
edit any other code, except the function's body, doing so may jeopardize your evaluation*
sol3-------------------------------------------
no_list = [1,2,3,4]
def maximum(no_list):
#complete the function to return the highest number in the list
high = no_list[0]
for e in no_list:
if e > high:
high = e
return high
print(maximum(no_list))
------------------------------------------------------------------------------
Task 4:¶
You are required to complete the function unique_list(l). where "l" is a list of numbers. the function is expected to return the unique numbers in that list.
Example:
input : [1,1,1,2,2,3,3,3,3,4,5,5,6]
output: [1,2,3,4,5,6]
you are not allowed to change the variable names or their values or edit any other code, except the function's body, doing so may jeopardize your evaluation
sol4------------------------
no_list = [22,22,2,1,11,11,2,2,3,3,3,4,5,5,5,55,55,66]
def unique_list(l):
#complete the function's body to return the unique list of numbers
unique = []
for x in l:
if x not in unique:
unique.append(x)
return unique
print(unique_list(no_list))
Forwarded from Azamat Qo'chqarov
Бир миллион дастурчи жавоблари.doc
40.5 KB
Бир миллион дастурчи
Йўналишлар бўйича барчасининг жавоблари 100%
Йўналишлар бўйича барчасининг жавоблари 100%
Forwarded from ️Islom Imomaliyev
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Abdulaziz 🌙 Baxriddinov
Toshkentga ketish uchun 6x70000 qaytish kechikganimiz sababli 6x80000. Qo’liq vodiy petakdan bo’ldi!
Forwarded from Abdulaziz 🌙 Baxriddinov
Forwarded from 💻Visual📡Time📸 (Abdulaziz Baxriddinov Rashid o'g'li)
86-ИДУМ uzbekcoders 11-sinflar (2) (2).xlsx
15.4 KB