Pyramid display
Write a program that receives a word from the user and prints it as follows:
Write a program that receives a word from the user and prints it as follows:
word =input("namr: ") for i, l in enumerate(word): print(word[:i+1])
name = input("Enter name : ") len_name = len(name) for x in range(1, len_name + 1): print(name[:x]) for y in range((len_name) - 1 , 0 , -1) : print(name[:y])
word = (input("Please enter your word: ")) temp = "" res = [] word_lst = list(word) for i in range(len(word_lst)): temp += word_lst[i] res.append(temp) print(res[i]) for i in range(1,len(word_lst)): print(res[-i-1])
word = (input("Please enter your word: ")) for i in range(len(word)+1): print(word[:i]) for i in range(len(word)): print(word[:-i-1])
a=input('word:') print(a[:1]) print(a[:2]) print(a[:3]) print(a[:4]) print(a[:5]) print(a[:6])
def print_pattern(word): """الگوی مورد نظر را برای کلمه ورودی چاپ میکند.""" # Part One Printing: From one character to all characters for i in range(1, len(word) + 1): print(word[:i]) # Printing Part Two: From n-1 character to a character for i in range(len(word) - 1, 0, -1): print(word[:i]) def main(): # Get a word from the user word = input("لطفاً یک کلمه وارد کنید: ") # Pattern printing print_pattern(word) # Implementation of the main function if __name__ == "__main__": main()
Submitting answers is currently unavailable.
Scissors Paper Play: 1- The user chooses one between paper or scissors. 2- Select the system by random. 3- With the choice of user and system, the result is displayed and the user's rating is calculated 4- ... ...
Write a program that receives 2 dates in yyyy/mm/dd format and print 2 dates to the output for example Tarikh1: 1401/11/01 tarikh2: 1401/11/05 4 days Tarikh1: 1401/10/01 Tarikh2: 1401/11/05 34 Days
Write a program that receives an email address and separates the various sections as follows and prints on the output example: email: [email protected] info amirhn.ir Example: email: [email protected] username gmail.com
Write a program that receives 2 users and calculates the Fibonacci series (between those two) and prints in the output
Define a class of User that has a username, email and password and the following methods. Print: Print username and email in the output IS_Gmail: Check whether the user's email is Gmail and ...
Write a class called Vehicle that has Model and Color features and has a method called get_info that returns all its features as a strang then write a class called Car from Vehicle ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.