بزرگترین عدد دریافت شده
برنامه ای بنویسید که 3 عدد دریافت کند و بزگترین آنها را در خروجی چاپ کند
برنامه ای بنویسید که 3 عدد دریافت کند و بزگترین آنها را در خروجی چاپ کند
a = float(input('num1: '))
b = float(input('num2: '))
c = float(input('num3: '))
if a>c>b or a>b>c:
print(a)
elif b>a>c or b>c>a:
print(b)
elif c>a>b or c>b>a:
print(c)
جالبه اینکه با چندین روش میشه یه کار انجام داد از نقاط قوت و جذاب برنامه نویسی هست
print(max([int(input('num1: ')),int(input('num2: ')),int(input('num3: '))]))
Good job
تمیز و خلاصه👏🏼
num1 = float(input("enter number 1: "))
num2 = float(input("enter number 2: "))
num3 = float(input("enter number 3: "))
if num1 > num2 and num1 > num3:
print("{} is the largest number".format(num1))
elif num2 > num1 and num2 > num3:
print("{} is the largest number".format(num2))
else:
print("{} is the largest number".format(num3))
d = int(input("enter the first number:"))
b = int(input("enter the second number:"))
s = int(input("enter the third number:"))
maximum = s
if b > max :
maximum = b
if d > max :
maximum = d
print(maximum)
a = int(input('yek adad vared konid:')) b = int(input('yek adad vared konid:')) c = int(input('yek adad vared konid:')) max = a if b > max: max = b if c > max: max = c print(max)
a =int(input('number1 :')
b = int(input('number2 :')
c =int(input('number 3:')
if a > b and a > c :
Print('number 1 is the largest')
elif b > a and b > c :
Print('number2 is the largest')
elif c > a and c > b :
Print('number 3 is the largest')
a = int ( input("ent 1 :") )
b = int ( input("ent 2 :") )
c = int ( input ("ent 3:") )
if a>b and a > c :
print ('biggest is:' ,a)
elif b>a and b > c :
print ('biggest is :',b)
elif c>a and c>b :
print ('biggest is:',c)
elif a==b and a==c and b==c :
print ("Same result")
a = input("number one: ")
a = int(a)
b = input("number two: ")
b = int(b)
c = input("number tree: ")
c = int(c)
if a > b and a > c :
print(a)
elif b > a and b > c :
print(b)
elif c > a and c > b :
print(c)
else :
print("har se adad mosavi")
list = []
while len(list) < 3 :
a = int(input("adad ra vared konid : "))
list.append(a)
list_betartib = sorted(list)
print("min = {} , max = {}".format(list_betartib[0] , list_betartib[2]))
adad1 = int(input('adad 1: '))
adad2 = int(input('adad 2: '))
adad3 = int(input('adad 3: '))
if adad1>adad2>adad3:
print (adad1)
elif adad1<adad2<adad3:
print (adad3)
elif adad1<adad2>adad3:
print (adad2)
a = float(input("first number : "))
b = float(input("second number : "))
c = float(input("third : "))
if a>b>c or a>c>b :
print(str(a) + " is bigest")
elif b>a>c or b>c>a :
print(str(b) + " is bigest")
elif c>b>a or c>a>b :
print(str(c) + " is bigest")
else : print('error')
a= float(input("a: ")) b=float(input("b: ")) c= float(input("c: ")) if a>=b and b>=c: print(a) elif b>=a and b>=c: print(b) elif c>=a and c>=b: print(c) if a==b==c: print("3 adad mosavi")
m = int(input('age:'))
n = int(input('age:'))
b = int(input('age:'))
a = 1
if m > a :
a = m
if n > a :
a = n
if b > a :
a = b
print(a)
def number():
num=[]
a=int(input("number 1 : "))
num.append(a)
b=int(input("number 2 : "))
num.append(b)
c=int(input("number 3 : "))
num.append(c)
print(max(num))
number()
x= int (input("number 1 ? "))
y= int (input("number 2 ? "))
z= int (input("number 3 ? "))
if(x>y and x>z):
print(f"{x} is the largest number")
elif (y>x and y>z):
print (f"{y} is the largest number")
else:
print (f"{z} is the largest number")
a = int(input("One number:"))
b = int(input("Two number:"))
c = int(input("Three number:"))
if a > b or a > c:
print(f"number one {a} The first number is the largest")
else:
if b > a or b > c :
print(f"number two {b} The first number is the largest")
else:
print(f"number three {c} The first number is the largest")
x = int(input("X: "))
y = int(input("Y: "))
z = int(input("Z: "))
if x > y:
if x > z:
print(x)
else:
print(z)
else:
print(y)
x = float(input("number1:")) y = float(input("number2:")) z = float(input("number3:")) if (x>y and x>z): print(f"{x} is largest number") elif (y>x and y>z): print(f"{y} is largest number" ) else: print(f"{z} is largest number ")
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))
# Find the maximum of the three numbers using the built-in max function
max_num = max(num1, num2, num3)
print("The maximum number is: ", max_num)
1 = float(input ( "number1" )) 2 = float(input ( "number2" )) 3 = float(input ( "number3" )) 4 = "largest" if (1 > 2 and 1 > 3 ) ( 1 == 4) elif ( 2 > 1 and 2 > 3 ) ( 1 == 4 ) elif ( 3 > 1 and 3 > 2 ) ( 1 == 4 )
a = int(input("nimber : "))
b = int(input("nimber : "))
c = int(input("nimber : "))
if a > b and c:
print(a)
elif b > c:
print(b)
else:
print(c)
x = int(input("Enter the first number :"))
a = int(input("Enter the second number :"))
b = int(input("Enter the third number :"))
if (x<a,b) :
print("The first number is bigger.")
elif (a<b,x) :
print("The second number is bigger.")
elif (b<a,x) :
print("The third number is bigger.")
x = int(input("Enter the first number :")) a = int(input("Enter the second number :")) b = int(input("Enter the third number :")) if x>a and x>b: print("The first number is bigger.") elif a>b and a>b: print("The second number is bigger.") elif b>a and b>x: print("The third number is bigger.")
num1 = int(input('Enter your a Number1: '))
num2 = int(input('Enter your a Number2: '))
num3 = int(input('Enter your a Number4: '))
temp = 0
maxnumber = num1 if num1 > num2 else num2
maxnumber = maxnumber if maxnumber > num3 else num3
print(maxnumber)
#------------------------------------------------------------------------------------------------------
num1 = int(input('Enter your a Number1: '))
num2 = int(input('Enter your a Number2: '))
num3 = int(input('Enter your a Number4: '))
temp = 0
if num1 > num2:
temp = num1
num1 = num2
num2 = temp
if num1 > num3:
temp = num1
num1 = num3
num3 = temp
if num2 > num3:
temp = num2
num2 = num3
num3 = temp
print(f'the maximum number is : {num3}')
print('kodom bozorgtare?') a=float(input('adad 1 : ')) b=float(input('adad 2 : ')) c=float(input('adad 3 : ')) if a>b and a>c: print('{} bozorgtar ast'.format(a)) elif b>a and b>c: print('{} bozorgtar ast'.format(b)) elif c>a and c>b: print('{} bozorgtar ast'.format(c))
num1=int(input("Please Enter Number1: "))
num2=int(input("Please Enter Number2: "))
num3=int(input("Please Enter Number3: "))
result=max(num1,num2,num3)
print('Maximum Number Between %d,%d and %d is %d'%(num1,num2,num3,result))
nam1 = int (input("enter nomber 1 : ") ) nam2 = int (input ("enter nomber 2 : ")) nam3 = int (input ("enter nomber 3 :")) if nam1>nam2 and nam1>nam3 : print ("{} is the biggest " .format (nam1)) elif nam2>nam1 and nam2>nam3 : print ("{} is the biggest " . format (nam2)) elif nam3>nam2 and nam3>nam1 : print ("{} is the biggest " .format (nam3))
a = int(input()) b = int(input()) c = int(input()) d = 0 if a > b and a > c: print(a) elif b > a and b > c: print(b) elif c > a and c > b: print(c)
a=int(input(' enter a number: ')) b=int(input(' enter a number: ')) c=int(input(' enter a number: ')) if a>b and a>c: print(bozrgtar ast') elif b>a and b>c: print(b,'bozorgtar ast ') else: print(c,' bozorgtar ast')
a = int(input("first number:")) b = int(input("second number:")) c = int(input("thired number:")) max = 0 if a > max: max = a if b > max: max = b if c > max: max = c print("max is:", max)
num1 = int(input('Enter your a Number1: ')) num2 = int(input('Enter your a Number2: ')) num3 = int(input('Enter your a Number3: ')) list_of_nums = [num1, num2, num3] print(max(list_of_nums))
a=[int(input('num1: ')),int(input('num2: ')),int(input('num3: '))]
if a[0]==a[1]or a[0]==[2]or a[1]==a[2]:print('Your numbers are equal')
else:print(int(max(a)))
a = int(input("a:"))
b = int(input("b:"))
c = int(input("c:"))
max = 0
if a > max:
max = a
if b > max:
max = b
if c > max:
max = c
print (max)
number1 = input("enter number 1: ") number2 = input("enter number 2: ") number3 = input("enter number 3: ") print(max(number1)) print(max(number2)) print(max(number3))
b = []
for i in range(1, 4):
num = int(input(f"Please enter your number {i}:"))
b.append(num)
print(f"Your maximum number is {max(b)}")
adad_bozorg = 0
a = int(input('adad 1:'))
b = int(input('adad 2:'))
c = int(input('adad 3:'))
if a > adad_bozorg :
adad_bozorg = a
if b > adad_bozorg :
adad_bozorg = b
if c > adad_bozorg :
adad_bozorg = c
print('-' * 50)
print(adad_bozorg)
print('-' * 50)
x = int(input('enter : ')) v = int(input('enter : ')) c = int(input('enter : ')) print(max(x, v, c))
a = float(input("First Number = "))
b = float(input("Seccond Number = "))
c = float(input("Third Number = "))
max = 0
if a > max:
max = a
if b > max:
max = b
if c > max:
max = c
print("{} is largest number you enterd.".format(max))
quit = input("Press ENTER to close")
a =float(input("Enter"))
b =float(input("Enter"))
c =float(input("Enter"))
if a>c>b or a>b>c:
print("bigges number:", a)
elif b>a>c or b>c>a:
print("biggest number:",b)
else:
print("biggest number:",c)
name1 = int(input("number 1: "))
name2 = int(input("number 2: "))
name3 = int(input("number 3: "))
max = 0
if max < name1:
max = name1
if max < name2:
max = name2
if max < name3:
max = name3
print("the highest number is", max)
num1 = int(input("E1: ")) num2 = int(input("E2: ")) num3 = int(input("E3: ")) print(max(num1, num2, num3))
a = float (input ("num 1: "))
b = float (input ("num 2: "))
c = float (input ("num 3: "))
print (max(a,b,c))
a = float (input ("Num1?:")) b = float (input ("Num2?:")) c = float (input ("Num3?:")) if a>b>c or a>b>c: print (a) if b>a>c or b>c>a: print (b) if c>a>b or c>b>a: print (c)
inp1 = input("Numbers: ").split(',')
print(max(inp1))
first = int(input("Enter the first number:"))
second = int(input("Enter the second number:"))
third = int(input("Enter the third number:"))
print(max(first, second, third))
n = int(input("enter your number: ")) m = int(input("enter your number: ")) h = int(input("enter your number: ")) if n > m and n > h : print (n) elif m > n and m > h : print (m) elif h > n and h > m : print (h) else : print("Your answer is wrong")
print(max(float(input ("adad a vared konid ")),float(input ("adad b vared konid ")),float(input ("adad c vared konid "))))
n1 = int(input("first number: n1=")) n2 = int(input("second number: n2=")) n3 = int(input("third number: n3=")) print (f'maximum number:{max(n1, n2, n3)}')
a=int(input("adadeh avval ra vared konid : "))
b=int(input("adadeh dovoom ra vared konid :"))
c=int(input("adadeh sevoom ra vared konid :"))
if a>b and a>c :
print(a)
elif b>a and b>c:
print(b)
else :
print(c)
A = int(input('عددی وارد کنید ')) B = int(input('عدد دوم را وارد کنید ')) C = int(input('عدد سوم را وارد کنید ')) if A>B>C: print(A) elif B>A>C: print(B) elif C>A>B: print(C)
def my_number(a,b,c): if a >b and a>c: print(a) elif b >a and b>c: print(b) else: print(c) a = int(input("enter number1:")) b = int(input("enter number2:")) c = int(input("enter number3:")) my_number(a,b,c)
a=float(input("enter your frist digit: ")) b=float(input("enter your secend digit: ")) c=float(input("enter your third digit: ")) if a>b and a>c: print("{} is bigger".format(a)) elif b>a and b>c: print("{} is bigger".format(b)) elif c>a and c>b: print("{} is bigger".format(c)) elif a==b>c: print("your {} and {} are biggers".format("frist digit","secend digit")) elif a==c>b: print("your {} and {} are biggers".format("frist digit","third digit")) elif b==c>a: print("your {} and {} are biggers".format("secend digit","third digit")) else: print("None of those is not bigger")
a =int(input('1namner:'))
s =int(input('2namner:'))
d =int(input('3namner:'))
if a>s>d or a>d>s:
print(a)
elif s>d>a or s>a>d:
print(s)
elif d>s>a or d>a>s:
print(d)
else:
print("{}={}={}".format(a ,s, d))
a = int(input("please enter number 1 :"))
b = int(input("please enter number 2 :"))
c = int(input("please enter number 3 :"))
if a>b and a>c:
print("maximum :",a)
elif b>a and b>c:
print("maximum :",b)
elif c>a and c>b:
print("maximum :",c)
else :
print("error")
#تابع بزرگترین عدد
def MAX():
#لیست محل ذخیره اعداد
list_max=[]
#عدد مورد نظر برای افزودن به لیست
number=int(input('enter a number: '))
#حلقه وایل برای دادن مقادیر نامبر به لیست
while number!=-1:
list_max.append(number)
number=int(input('enter a number: '))
#متغییر مکس برای به دست آوردن بزرگ ترین
max=list_max[0]
#حلقه فور برای بررسی بزرگترین مقدار
for i in range(1,len(list_max)):
if max<=list_max[i]:
max=list_max[i]
#مقدار ریتورن شده توسط تابع
return max
#فراخوانی تابع
print(MAX())
a = int(input("enter number 1:"))
b = int(input("enter number 2:"))
c = int(input("enter number 3:"))
print(a,"bozorg tar ast") if a > b and a >c else (print(b,"bozorg tar ast")) if b > a and b > c else print(c,"bozorg tar ast")
firstNumber = input('please enetr a first number : ')
secondNumber = input('please enetr a second number : ')
thirdNumber = input('please enetr a third number : ')
if firstNumber > secondNumber and firstNumber > thirdNumber:
print(firstNumber)
elif secondNumber > thirdNumber:
print(secondNumber)
else:
print(thirdNumber)
num1=float(input('first number : ')) num2=float(input('second number : ')) num3=float(input('third number : ')) numbers=[] numbers.append(num1) numbers.append(num2) numbers.append(num3) numbers=sorted(numbers) print(numbers[-1])
a=int(input("please type first number: ")) b=int(input("please type second number: ")) c=int(input("please type third number: ")) mlist=[a,b,c] max_list=max(mlist) print(max_list)
a=int(input("x")) b=int(input("y")) c=int(input("w")) if a>b>c : print(a) elif a>c>b: print(a) if b>a>c : print(b) elif b>c>a: print(b) if c>a>b : print(b) elif c>b>a: print(b)
list_of_nums = []
for i in range(3):
number = int(input("Enter number: "))
list_of_nums.append(number)
print(f"maximum number: {max(list_of_nums)}")
one_num = float(input('num1: '))
two_num = float(input('num2: '))
three_num = float(input('num3: '))
max_number = max(one_num, two_num, three_num)
print("The largest number : ", max_number)
a=int(input("a=")) b=int(input("b=")) c=int(input("c=")) if a<b and a>c : print("bozorgtarin adad=",a) elif b>a and b>c : print("bozorgtarin adad=",b) else : print("bozorgtarin adad=",c)
x = int(input("number 1:"))
y = int(input("number 2:"))
z = int(input("number 3:"))
print(max(x,y,z))
تابعی بنویسید که یک رشته (String) دریافت کند و تعداد حروف آن را برگرداند نکته: برای حل این سوال، از توابع آماده نباید استفاده کنید مثال:get_len('code-bezan.ir') # 13
تابعی بنویسید که دو عدد به همراه یک عملگر (+ - / *) دریافت کند و محاسبه مربوطه را انجام دهد و نتیجه را برگرداند مثال:cal(2, '+', 6) #8 cal(5, '-', 1) #4 cal(6, '/', 2) #3 cal(8, '*', 2) #16
برنامه ای بنویسید که یک عدد از کاربر دریافت کند و جدول ضرب آن عدد را همانند زیر در خروجی چاپ کند yek adad vared konid: 2 2 x 1 = 2 2 x 2 = 4 2 x 3 = 6 2 x 4 = 8 2 x 5 = 10 2 x 6 = 12 2 x 7 = 14 2 x...
برنامه ای بنویس که طول ضلع مربعی را از ورودی دریافت کند و مساحت آن را حساب کن مساحت مربع = یک ضلع ضربدر خودش = یک ضلع یه توان 2
برنامه ای بنویس که متنی بصورت کدمورس از ورودی دریافت کند و طبق جدول زیر ترجمه آن را در خروجی چاپ کند همچنین بتواند متن انگلیسی از ورودی دریافت کند و به کدمورس تبدیل کند مثال:input: hooshang . . . ....
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام
اگه متوجه تمرین نمیشی یا به هر دلیلی نمیتونی حلش کنی، کاملا طبیعیه، اشکالی نداره؛ ناراحت نشو
😊
سعی کن تمرینات آسون تر رو ببینی و جواب های مختلفی که دیگران ارسال کرده اند رو بررسی کنی و
یواش یواش به سراغ تمرینات سخت تر بری.
همچنین ممکنه جوابت درست باشه ولی با سایر جواب ها متفاوت باشه
اگه برنامه نویسی رو هنوز شروع نکردی یا خوب یاد نگرفتی، میتونی از طریق لینک زیر یاد بگیری