Investigating the figures of the number
Write a program that receives a number of input and prints its smallest and largest digit
Write a program that receives a number of input and prints its smallest and largest digit
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
m=[] n=input("enter:") for i in n : m.append(int(i)) m.sort() x=len(m) print (f"min={m[0]} max={m[x-1]}")
while True: num = input("enter your number:") if num == "0": print("end") break dgh = [int(dgh) for dgh in num] mindgh = min(dgh) maxdgh = max(dgh) print(f"kochak tarin addad: {mindgh}") print(f"bozorgtarin addad: {maxdgh}")
N1=int(input("Enter Number: ")) N2=int(input("Enter Number: ")) # ّ Find the Largest Number largest = max(N1,N2) print("This is the largest number:",largest) # Find the smallest number smallest = min(N1,N2) print("This is the smallest number:",smallest)
def s(number): digits = [int(digit) for digit in str(number)] max_digit = max(digits) min_digit = min(digits) return max_digit, min_digit num=int(input("num: ")) max_digit, min_digit=s(num) print(f"max: {max_digit}") print(f"min: {min_digit}")
x = 0 a = input('enter the number') for i in a : i = int(i) if x < i : x = i z = x print(x,'بزرگترین رقم') for j in a : j = int(j) if z > j : z = j print(z,'کوچکترین رقم')
print("enter you list") x = input(list()) y = sorted(x) # From small to large to large print(y)
Had three corrections that were corrected above
i=input('num:') s=[int(digit)for digit in i] print(s)
Submitting answers is currently unavailable.
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.