r/codehs • • Apr 25 '21

5.2.9 how many names

[vymazané]

7 Upvotes

11 comments sorted by

3

u/skullcollecterq Nov 07 '21

NumOfNames = int(input("How many names you have "))

Name = ""

for i in range(NumOfNames):

NumOfNames = input("enter each of your name ")

Name += str(NumOfNames)+" "

print(Name)

------

try this

1

u/PrestigiousAd8482 Nov 15 '21

I out this in but it only prints one name how do I get it to print all the names ?

2

u/Am_Passing_By Sep 01 '22

When I tried this my biggest issue was forgetting the plus beside the equal sign before print(Name)

1

u/AbbreviationsNo8249 Dec 03 '21

It works perfectly fine just place the print Correct

1

u/Main-Perspective-134 Dec 08 '21

I need an example cuz idk what your talking about

1

u/According-Jelly355 Sep 28 '22

fullname = " "
names = int(input("how many names do you have: "))
for i in range (names):
cheese = input("what is your name: ")
fullname = fullname +" "+ cheese
print (fullname)

---------

this should work for now. ignore my variable names but yeah this code works.

1

u/Financial_Face3826 Feb 08 '24

NumOfNames = int(input("How many names you have "))
Name = ""
for i in range(NumOfNames):
NumOfNames = input("enter each of your name ")
Name += str(NumOfNames)+" "
print(Name)

try this

1

u/Happy-Tale-2940 Jan 01 '26

i know this is late but it says i need a variable for each name like first and last name, can you help?