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)
while 1:
num = int(input("adadi ke mikhahid be tavan 2 shavad ra vared konid: "))
if num == 0:
break
print(num**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)
Submitting answers is currently unavailable.
We want to open a cow door, we don't know the safety password, but we have the following information: the second -digit safing password is the third digit, the last 4th of the person in the last one is smaller than their first digit ...
Suppose we have the following 2 tables Users-> name, idbooks-> User_id, id, name 1- Write a query that shows user-related books at No. 2- Write a query to user names a ...
Write a class called Tarikh to receive a solar date in yyyy/mm/dd format and has methods to add and reduce (day, month and year) of date. Also have a method for printing the date on the output. ...
Write a program that receives a number and prints the first counters in the output
We want to open the cow door, we don't know the password, but we have the following information: the second -digit safing password and the fifth digit equivalent to the first number of the first digit of a larger unit ...
Create a link with the following details by clicking the user link to be directly calling 090000000.
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.