- 4

Please give me the actual code!(python3) I'm stuck here for last 2 days!!!

Today is a holiday at the children's camp, so all the children will be served ice cream. There are 3 groups of children: 23 children in the first group, 27 in the second, and 18 in the third. Every child should get 2 scoops of ice cream. Write a program to calculate and output the total number of ice cream scoops we need.

7th Feb 2021, 12:29 AM
Nafiz Rahman
Nafiz Rahman - avatar
22 odpowiedzi
+ 3
#slove g1 = int (input("Total member of group one !")) g2 = int (input("Total member of group two !")) g3 = int (input("Total member of group three !") ice = 2 * (g1 + g2 + g3) print (ice,"ice cream needed") print ("End")
8th Feb 2021, 5:17 PM
Mohibul Alam
Mohibul Alam - avatar
+ 2
Okay, post your attempt and we got you!
7th Feb 2021, 12:46 AM
Slick
Slick - avatar
+ 1
print ( 23 * 2 + 27 * 2 + 18 * 2 ) What's the difference between your code and my code? ArrUn Mohibul Alam
8th Feb 2021, 10:14 PM
Nafiz Rahman
Nafiz Rahman - avatar
+ 1
print( ( 20 + 30 + 18 ) * 2 )
26th Sep 2022, 4:58 PM
Pusparasa Ayilavan
Pusparasa Ayilavan - avatar
0
Look over data types. Strings are like words, and you cant add words and expect them to be treated like numbers. '1' + '2' is '12'. But 1 + 2 is 3
7th Feb 2021, 4:28 AM
Slick
Slick - avatar
0
Nafiz Rahman Read about data type in programming. print ( ' 23 * 2 + 27 * 2 + 18 * 2 ' ) - this code print a string because contains quotes print ( 23 * 2 + 27 * 2 + 18 * 2 ) - this code print the mathematical expression of all numbers You can f-string too. For example: print ( f"{ 23 * 2 + 27 * 2 + 18 * 2 }" )
9th Feb 2021, 2:53 AM
Valerii Mamontov
Valerii Mamontov - avatar
0
Print(68*2)
8th Jul 2022, 8:15 AM
Swachho Gomes
- 1
The problem with that code is you're attempting to print out the whole equation as a string. Anything in between ' ' or " " is considered a string, even numbers. Try losing the quotes and get back after that if you still have issues
7th Feb 2021, 1:52 AM
Slick
Slick - avatar
- 1
print ( '23 * 2' ) print ( '27 * 2' ) print ( '18 * 2' )
7th Feb 2021, 4:23 AM
Nafiz Rahman
Nafiz Rahman - avatar
- 1
I'm not clear about what are you trynna say...😐
7th Feb 2021, 4:24 AM
Nafiz Rahman
Nafiz Rahman - avatar
- 1
Thank you so much guys!🖤🖤🖤 It's really kind of you!
7th Feb 2021, 6:10 AM
Nafiz Rahman
Nafiz Rahman - avatar
- 1
I solved it!
7th Feb 2021, 6:10 AM
Nafiz Rahman
Nafiz Rahman - avatar
- 1
group_1st = 23 group_2nd = 27 group_3rd = 18 total = group_1st+group_2nd+group_3rd print (total*2)
18th Apr 2021, 4:00 PM
Somnath Guli
Somnath Guli - avatar
- 1
# Group 1 x=(23*2) # group 2 y=27*2 # group 3 z=18*2 # Total scoops sccops=x+y+z print(sccops)
7th May 2021, 5:04 PM
Vishal Sharma
Vishal Sharma - avatar
- 1
a = 23; b = 27; c = 18; print((a*2) + (b*2) + (c*2)) 136 I'm just learning python, I hope it helps you solve the exercise
14th May 2021, 6:39 AM
Karina Trejo
Karina Trejo - avatar
- 1
a=2*23 b=2*27 c=2*18 z=a+b+c print(z)
21st Jul 2021, 6:43 PM
Peyman Daei Rezaei
Peyman Daei Rezaei - avatar
- 1
print (2*(23+27+18))
4th Jan 2022, 8:10 AM
Dhruv Verma
- 1
print (62*2)
20th May 2022, 2:10 PM
Ambati Venkateswarlu
- 2
Really?! Do you have to program an AI and make it understand what the problem is or what? Come on, not only you can do it on a calculator, you can do it by hand!
7th Feb 2021, 1:00 AM
Angelo
Angelo - avatar
- 2
print ( ' 23 * 2 + 27 * 2 + 18 * 2 ' )
7th Feb 2021, 1:24 AM
Nafiz Rahman
Nafiz Rahman - avatar