Python Challenges: List with reversed number

Transcript

English (Auto-generated)

Okay. So right now we are going to be doing another court challenge but before we get started, I want to be clear that in this week we are going to be focusing on making on using types. What types are, what types are there and manipulating them as much as we can. So yeah, today we're gonna be working mainly with integers, Bliss and kind of strings I guess you could say. So we're working with a little bit of everything. So let's see how it goes. So basically for this challenge, what we need to do is, let's say we're given a my number, let's say we're given 321. We have to return a list with it reversed but not like this. Okay, we're not gonna do that. We're going to make it one and then two and then three. Okay, so for any confusions, that's how we're gonna do that. Okay, so the first thing that we need to do in this situation is you know you guys, I'm sorry. Okay. So the first thing that I apologize, I don't know if you guys heard bones, birds but oh well okay. The first thing that we need to do is trinity string really quick and then what's that dan, keep getting out. I'm sorry. Okay. And we're gonna make this cold, you know? And then this is going to eat that and then we're going to create an empty list. Alright here called list. Okay, so now what we're going to do is we're gonna use a for loop to go through everything in our strength four Number in Stream Numb. Okay. Are you guys going on there? We're gonna add it to the end of the string and let me say sorry to the beginning of the string. That way it's going to be automatically reversed list equals we're gonna do mm hmm. We're going to do and Oh, number. Okay. Plus list. Okay. And then we're just going to return the list. I know, but it's super simple. But to me, it's actually super cool that we can do it that way. And then let's try it out. So we're gonna do print the name of our function reversing raise. Mm hmm. Uh what number should we get? Let's give it 700 7800 10 53. So let's see how that works out. Let me say that. I will try to say that. I wouldn't have one python, three reverse arrays. How you might be confused as to what color to raise. Maybe not. But I also work with javascript. Little bit analysts raising javascript. So I apologize for the confusion but in python the correct, see our list to call them on this. Okay. And we are given an error. Let's see. Can't open file. But I think I put it down somehow, nope. I put it perfectly fun. So what is going on? No such file or directory? It's because it's in another. Okay. Wait, you guys. Mm hmm trips. Aah, okay. You know what? I'm just gonna take it out of this folder because that's too much to deal with right now. Okay. And we're giving a different era, but there's always one with our code. So it's actually, well, type object is not okay. Well, oh, sorry. I'm using different types of where we want parentheses, not square brackets. That is a syntax error. And there we go. It works perfectly now. Let's start with the different number. We usually don't try it with a bunch of different things and we don't know if it's actually gonna work if we don't use the correct one. So now we're gonna do that and let's see if it works now. Okay. So they were exposed to me as always, you can try to evacuate as much as you want or and try to clean it up as you want. Or maybe just come up with a different solution in general. But this is my solution. This is my way of doing it. And of course it could be a lot cleaner. So I would appreciate if you guys send me your solutions. Thank you so much and see you later.
136 Views 0 Likes 0 Comments

Simple, we are given a number and we have to return a list with the reversed number

Comment
Leave a comment (supports markdown format)