Name of the weeks of the week
Write a program that shows its name by receiving the day number of the week
Write a program that shows its name by receiving the day number of the week
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
def week(): """ تابع روز های هفته را بر اساس ترتیب اعداد چاپ میکند """ while True: try: user_input = int(input("please enter a number between 1 and 7(exit=0) :")) if user_input == 0: # If it is zero out of the program print("good bye...") break if not user_input in range(1,8): # If it wasn't between one and 7 print("The number must be between 1 and 7⛔") match user_input: case 1:print("saturday") case 2:print("sunday") case 3:print("monday") case 4:print("tuesday") case 5:print("wednesday") case 6:print("thursday") case 7:print("friday") except ValueError: # Receive Error text if the application is logged but the program does not stop print("please enter a integer amount⛔") week() # Farakhani
# Receive Input i=input("input: ") # Define the weeks of the week with dictionary hafte={"1":"shanbe","2":"yek shanbe","3":"do shanbe","4":"se shanbe" ,"5":"chahar shanbe","6":"panj shanbe","7":"jome"} # Displaying the output print(hafte[i])
days={"1":"shanbe","2":"yek_shanbe","3":"do_shanbe","4":"se_shanbe" ,"5":"chhar_shanbe","6":"panj_shanbe","7":"jome"} a= input() print(days.get(a)
# Getting the number of the day of the week from the user x=int(input('Shomareh rooz mored nazar ra vared konid:')) if x == 1: print('Shanbeh') elif x == 2: print('Yekshanbeh') elif x == 3: print('Doshanbeh') elif x == 4: print('Seshanbeh') elif x == 5: print('Chaharshanbeh') elif x == 6: print('Panjshanbeh') elif x == 7: print('Jomee')
while True: try: day = int(input("Enter the number:")) if day == 1: print("Shanbe") elif day == 2: print("yek Shanbe") elif day == 3: print("do Shanbe") elif day == 4: print("se Shanbe") elif day == 5: print("chahar Shanbe") elif day == 6: print("panj Shanbe") elif day == 7: print("jome") else: print("Shoma faghat mitavanid adade yek ta haft ra vared namayid.") except: print("Please enter a number.")
function daysOfWeek(daynumber) { const days =['Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday']; if (daynumber >=8) { return 'your number is undefined'; }else{ daynumber--; let result=days[daynumber]; return result; } }
number = int(input("enter your number: ")) if number == 1: print("shanbe") elif number == 2: print("yekshanbe") elif number == 3: print("doshanbe") elif number == 4: print("seshanbe") elif number == 5: print("chaharshanbe") elif number == 6: print("pangshanbe") elif number == 7: print("jomme") else: print("the number must be between 1 and 7")
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.