Summary of the text
Write a function that receives a text and returns the first 100 characters with "..." if the text is longer than 100 characters. Otherwise it will restore the whole text unchanged.
Write a function that receives a text and returns the first 100 characters with "..." if the text is longer than 100 characters. Otherwise it will restore the whole text unchanged.
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
import math as m def matn(m): # Check whether the text is 100 characters if len(m) >= 100 : return m[:100] + "..." else : return m matnvorodi=input('matn morede nazar ra vared konid:') print(matn(matnvorodi))
def short(x): if len(x) > 100: b = x[:100+1] + '...' return b else: return x txt = input('text: ') print(short(txt))
def short_passage(passage): if len(passage) > 100: shorted_passage = passage[0:100] return shorted_passage else: return passage def main(): passage = input("please Enter your passage: ") editted_passage = short_passage(passage) #print("«" + editted_passage + "»" ) print(f"«{editted_passage}»") if __name__ == "__main__": main()
def short_String(string): if len(string) > 100: return string[0:100] + "..." else: return string num = input('string: ') print(short_String(num))
def matn(): str = input("please enter a string: ") if len(str) > 100: print (str[0: 100], "...") else: print(str) print(len(str)) matn()
def text(t): if len(t) > 100: return t[:100] + "..." else: return t text(input("Enter :")) print(text)
text = input('Enter your text : ')
def text_spilt(text):
if len(text) <= 100 :
return text
else:
return f'"{text[0:101]}"'
print(text_spilt(text))
Submitting answers is currently unavailable.
Write a program that gets distance to meters and converts to kilometers and shows at the output tips: each km = 1000 m
Write a program that receives the age of father and son from the input and prints them (subtraction) in the output
Write a program that receives a store product listing including name and product price and will continue until the amount of empty value for the product name is entered; Then the product name is displayed as a list ...
Write a function that receives the number of hours of employee work per month as a parameter and calculates the amount of employee salaries according to the formula below and returns each employee for 2 hours of work per month, per hour at 4 ...
Write a program that receives a number and from that number to 0 countdown is required between each number of 1 second pauses
Write a class that receives rectangular length, width and height and calculates its area and volume using different methods
Write a function to get a string and return the length of the string Tip: In this exercise you should not use ready -made functions like Len in Python
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.