Numbers to power 2
Write a program that receives a number from the input and increases the number 2 and prints in the output. This trend continues until the number 0 is not arrived
Write a program that receives a number from the input and increases the number 2 and prints in the output. This trend continues until the number 0 is not arrived
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
while 1: number=float(input("enter numbers:")) a=number**2 if number !=0: print(a) else: break print("end")
#With user interface
from tkinter import *
def calculate():
if number_entry.get() == 0:
window.destroy()
power_two_label.config(text=float(number_entry.get())**2)
window = Tk()
enternumber_label = Label(window,text="Enter a number")
number_entry = Entry(window)
power_two_label = Label(window,text="")
calculate_button = Button(window,text="Calculate",command=calculate)
enternumber_label.pack()
number_entry.pack()
power_two_label.pack()
calculate_button.pack()
window.mainloop()
#Without user interface
while True:
try:
number = float(input("Enter a number : "))
except ValueError:
print("You can just enter number!")
if number == 0:
break
print(number**2)
def main(): while True: # Get a number from the user number = float(input("لطفاً یک عدد وارد کنید (برای خروج 0 را وارد کنید): ")) # Check out of the loop if number == 0: print("برنامه به پایان رسید.") break # Calculating and printing power of 2 pcs squared = number ** 2 print(f"{number} به توان 2 برابر است با: {squared}") # Implementation of the program main()
while 1: number = int(input("enter num: ")) if number != 0: power = number ** 2 print(power) else: break print("end")
number = 1 while True: try: if not number == 0: number = int(input("enter your number:")) print(f"your number:{number ** 2}") else: break except: print("eror")
while 1: number = int(input("please enter a number: ")) if number == 0: break else: print("number ** 2 = ", number ** 2)
number = int(input("enter your number:")) tavvan = number ** 2 if number == 0: print("end") else: print(tavvan)
Submitting answers is currently unavailable.
Write a program that can obtain the average infinite number of numbers: First, the program must receive the user's numbers (until the user does not enter the number 0, the numbers must continue ...
Write a program that receives a number and prints the figure below according to the number, the Number Example: 3 #######Number Example: 5 #######################
Build a table with HTML to show the following information: Name, Score, Hassan Hassani 17.25 Afforded Mohammadi Mohammed Hassani 13 Accept Mohammad Rezaei 9 Receives 19 Mardi Milad Mohammadi 12 ...
Write a program that receives any professors including name, age and city from the entrance.
Write a program that receives a number and from that number to 0 countdown is required between each number of 1 second pauses
Create a link with the following specifications. The phrase link (click here) should be on the code-bezan.ir page Title the phrase (programming exercise) be open but open on the new page
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.