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 a():
t = input("text:")
if len(t) > 100:
return t[:100] + "..."
else:
return t
print(a())
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)
Submitting answers is currently unavailable.
Write a function that receives 2 numbers as parameter (A and B) and get A to power B and return
Create a button below: when the mouse marker is on it:
Write a program that receives the address of a file as input and prints the file size to megabyte on the output
Write a program that receives a number from the user and converts to letters suppose the numbers entered between 0 and 1000000 23 ➞ Twenty Three 405 ➞ Four HundredR
You must be logged in to access this section.
Login/Sign up 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.