- 3

Read 7 numbers and print their squares and cubes

please tell asap

16th Sep 2019, 5:33 PM
Aryan Jain
10 Antworten
+ 1
why cant you start yourself? If you try and post your attempted code, ill help you.
17th Sep 2019, 12:30 AM
Choe
Choe - avatar
+ 1
i=0 while i<7: x=int(input("enter number 1")) square=x**2 cube=x**3 print("squares and cubes are:".square,cube) i=i+1
17th Sep 2019, 1:39 AM
Aryan Jain
0
print("/n".join([f"{int(el)**2}, {int(el)**3}" for el in input("Numbers: ").split()]))
16th Sep 2019, 5:39 PM
amchancy
amchancy - avatar
0
Show your attempt first
16th Sep 2019, 5:39 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
i was not able to stary
16th Sep 2019, 5:48 PM
Aryan Jain
0
start
16th Sep 2019, 5:48 PM
Aryan Jain
0
plz tell
16th Sep 2019, 6:03 PM
Aryan Jain
0
now help what is wrong
17th Sep 2019, 2:11 AM
Aryan Jain
0
well, youre looping your input, requiring you to place every individual number on 7 different lines. Lets just split the numbers from 1 input by whitespace. n = [int(i) for i in input().split()] if len(n)==7: for x in n: square=x**2 cube=x**3 print("squares and cubes are:",square,cube) sample input 1 2 3 4 5 6 7
17th Sep 2019, 2:46 AM
Choe
Choe - avatar
0
gotcha thnx
17th Sep 2019, 5:59 AM
Aryan Jain