Python Forum
square root of 6 input numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
square root of 6 input numbers
#1
Hi,

I want to find sqrt of 6 input numbers and append the result in lst (an empty array), Not able to pass multiple input in a function

from math import sqrt
def lists():
    x = input("Enter six value: ").split()
    
    lst = []  
    for i in x:
        math.sqrt(i)
    lst = lst.append(i)
    print(lst)
    print(type(ele))   
    return lst
list()
Please your support
Reply
#2
Note that input returns a string, so you need to convert the values in x to numbers (with the int or float functions, for example).

Also, please use "[python]" tags when posting code, because it adds syntax highlighting, line numbering and keeps the indentation.
Reply
#3
from math import sqrt
def lists():
x = int(input("Enter six value: ").split())

lst = []
for i in x:
math.sqrt(i)
lst = lst.append(i)
print(lst)
print(type(i))
return lst
list()
Please help me to fix the code
Reply
#4
There's no indentation. If it's not like that in your editor, then come on: you're probably getting some exceptions aren't you? What are they and what you do you think they mean?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using a For Loop to subtract numbers from an input function. Anunderling 9 2,819 Sep-22-2025, 08:56 PM
Last Post: deanhystad
  Im at square one even with trying to install python origen 1 1,396 Jan-12-2024, 05:39 AM
Last Post: ndc85430
  ValueError: Found input variables with inconsistent numbers of samples saoko 0 4,071 Jun-16-2022, 06:59 PM
Last Post: saoko
  Found input variables with inconsistent numbers of samples: [1000, 200] jenya56 2 5,342 Sep-15-2021, 12:48 PM
Last Post: jenya56
  square root of 5 input numbers mrityunjoy 1 3,160 Jun-10-2020, 11:08 AM
Last Post: perfringo
  How to simplify square finding program? meknowsnothing 3 4,616 Jun-11-2019, 08:20 PM
Last Post: meknowsnothing
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 5,919 May-09-2019, 12:19 PM
Last Post: Pleiades
  unable to pass a input after changing the user from root to non root using python avinash 3 4,710 Apr-08-2019, 10:05 AM
Last Post: avinash
  converting arguments or input numbers Skaperen 8 7,246 Aug-21-2018, 12:17 AM
Last Post: Skaperen
  cropping a picture (always square) Leon 1 3,509 Aug-13-2018, 10:04 AM
Last Post: Leon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020